diff --git a/.gitignore b/.gitignore
index 3567788f8..be64ce05c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,7 +37,7 @@ docs/metadata/
*.zip
# Generated build info file
-src/PowerShellEditorServices.Host/BuildInfo/BuildInfo.cs
+src/PowerShellEditorServices.Engine/Hosting/BuildInfo.cs
# quickbuild.exe
/VersionGeneratingLogs/
@@ -67,6 +67,7 @@ PowerShellEditorServices.sln.ide/storage.ide
# Don't include PlatyPS generated MAML
module/PowerShellEditorServices/Commands/en-US/*-help.xml
+module/PowerShellEditorServices.VSCode/en-US/*-help.xml
# Don't include Third Party Notices in module folder
module/PowerShellEditorServices/Third\ Party\ Notices.txt
diff --git a/PowerShellEditorServices.build.ps1 b/PowerShellEditorServices.build.ps1
index 0ac9ff998..9c4f77faa 100644
--- a/PowerShellEditorServices.build.ps1
+++ b/PowerShellEditorServices.build.ps1
@@ -27,7 +27,7 @@ $script:ModuleBinPath = "$PSScriptRoot/module/PowerShellEditorServices/bin/"
$script:VSCodeModuleBinPath = "$PSScriptRoot/module/PowerShellEditorServices.VSCode/bin/"
$script:WindowsPowerShellFrameworkTarget = 'net461'
$script:NetFrameworkPlatformId = 'win'
-$script:BuildInfoPath = [System.IO.Path]::Combine($PSScriptRoot, "src", "PowerShellEditorServices.Host", "BuildInfo", "BuildInfo.cs")
+$script:BuildInfoPath = [System.IO.Path]::Combine($PSScriptRoot, "src", "PowerShellEditorServices.Engine", "Hosting", "BuildInfo.cs")
$script:PSCoreModulePath = $null
@@ -174,7 +174,7 @@ function Invoke-WithCreateDefaultHook {
}
}
-task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestE2E, PackageNuGet {
+task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestE2E {
$dotnetPath = "$PSScriptRoot/.dotnet"
$dotnetExePath = if ($script:IsUnix) { "$dotnetPath/dotnet" } else { "$dotnetPath/dotnet.exe" }
@@ -253,7 +253,7 @@ task Clean {
Get-ChildItem $PSScriptRoot\module\PowerShellEditorServices\Commands\en-US\*-help.xml | Remove-Item -Force -ErrorAction Ignore
}
-task GetProductVersion -Before PackageNuGet, PackageModule, UploadArtifacts {
+task GetProductVersion -Before PackageModule, UploadArtifacts {
[xml]$props = Get-Content .\PowerShellEditorServices.Common.props
$script:BuildNumber = 9999
@@ -304,7 +304,7 @@ task CreateBuildInfo -Before Build {
[string]$buildTime = [datetime]::Now.ToString("s", [System.Globalization.CultureInfo]::InvariantCulture)
$buildInfoContents = @"
-namespace Microsoft.PowerShell.EditorServices.Host
+namespace Microsoft.PowerShell.EditorServices.Engine.Hosting
{
public static class BuildInfo
{
@@ -319,9 +319,7 @@ namespace Microsoft.PowerShell.EditorServices.Host
}
task Build {
- exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f $script:TargetPlatform }
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices.Engine\PowerShellEditorServices.Engine.csproj -f $script:TargetPlatform }
- exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices.Host\PowerShellEditorServices.Host.csproj -f $script:TargetPlatform }
exec { & $script:dotnetExe build -c $Configuration .\src\PowerShellEditorServices.VSCode\PowerShellEditorServices.VSCode.csproj $script:TargetFrameworksParam }
}
@@ -478,12 +476,7 @@ task RestorePsesModules -After Build {
task BuildCmdletHelp {
New-ExternalHelp -Path $PSScriptRoot\module\docs -OutputPath $PSScriptRoot\module\PowerShellEditorServices\Commands\en-US -Force
-}
-
-task PackageNuGet {
- exec { & $script:dotnetExe pack -c $Configuration --version-suffix $script:VersionSuffix .\src\PowerShellEditorServices\PowerShellEditorServices.csproj $script:TargetFrameworksParam }
- exec { & $script:dotnetExe pack -c $Configuration --version-suffix $script:VersionSuffix .\src\PowerShellEditorServices.Protocol\PowerShellEditorServices.Protocol.csproj $script:TargetFrameworksParam }
- exec { & $script:dotnetExe pack -c $Configuration --version-suffix $script:VersionSuffix .\src\PowerShellEditorServices.Host\PowerShellEditorServices.Host.csproj $script:TargetFrameworksParam }
+ New-ExternalHelp -Path $PSScriptRoot\module\PowerShellEditorServices.VSCode\docs -OutputPath $PSScriptRoot\module\PowerShellEditorServices.VSCode\en-US -Force
}
task PackageModule {
@@ -499,4 +492,4 @@ task UploadArtifacts -If ($null -ne $env:TF_BUILD) {
}
# The default task is to run the entire CI build
-task . GetProductVersion, Clean, Build, Test, BuildCmdletHelp, PackageNuGet, PackageModule, UploadArtifacts
+task . GetProductVersion, Clean, Build, Test, BuildCmdletHelp, PackageModule, UploadArtifacts
diff --git a/PowerShellEditorServices.sln b/PowerShellEditorServices.sln
index 71e28ed0d..91156418d 100644
--- a/PowerShellEditorServices.sln
+++ b/PowerShellEditorServices.sln
@@ -7,10 +7,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F594E7FD-1E7
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{422E561A-8118-4BE7-A54F-9309E4F03AAE}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices", "src\PowerShellEditorServices\PowerShellEditorServices.csproj", "{81E8CBCD-6319-49E7-9662-0475BD0791F4}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices.Host", "src\PowerShellEditorServices.Host\PowerShellEditorServices.Host.csproj", "{B2F6369A-D737-4AFD-8B81-9B094DB07DA7}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices.Test.Host", "test\PowerShellEditorServices.Test.Host\PowerShellEditorServices.Test.Host.csproj", "{3A5DDD20-5BD0-42F4-89F4-ACC0CE554028}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices.Test", "test\PowerShellEditorServices.Test\PowerShellEditorServices.Test.csproj", "{8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}"
@@ -22,8 +18,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{E231
scripts\AddCopyrightHeaders.ps1 = scripts\AddCopyrightHeaders.ps1
EndProjectSection
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices.Protocol", "src\PowerShellEditorServices.Protocol\PowerShellEditorServices.Protocol.csproj", "{F8A0946A-5D25-4651-8079-B8D5776916FB}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices.Test.Protocol", "test\PowerShellEditorServices.Test.Protocol\PowerShellEditorServices.Test.Protocol.csproj", "{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices.VSCode", "src\PowerShellEditorServices.VSCode\PowerShellEditorServices.VSCode.csproj", "{3B38E8DA-8BFF-4264-AF16-47929E6398A3}"
@@ -42,30 +36,6 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {81E8CBCD-6319-49E7-9662-0475BD0791F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {81E8CBCD-6319-49E7-9662-0475BD0791F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {81E8CBCD-6319-49E7-9662-0475BD0791F4}.Debug|x64.ActiveCfg = Debug|Any CPU
- {81E8CBCD-6319-49E7-9662-0475BD0791F4}.Debug|x64.Build.0 = Debug|Any CPU
- {81E8CBCD-6319-49E7-9662-0475BD0791F4}.Debug|x86.ActiveCfg = Debug|Any CPU
- {81E8CBCD-6319-49E7-9662-0475BD0791F4}.Debug|x86.Build.0 = Debug|Any CPU
- {81E8CBCD-6319-49E7-9662-0475BD0791F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {81E8CBCD-6319-49E7-9662-0475BD0791F4}.Release|Any CPU.Build.0 = Release|Any CPU
- {81E8CBCD-6319-49E7-9662-0475BD0791F4}.Release|x64.ActiveCfg = Release|Any CPU
- {81E8CBCD-6319-49E7-9662-0475BD0791F4}.Release|x64.Build.0 = Release|Any CPU
- {81E8CBCD-6319-49E7-9662-0475BD0791F4}.Release|x86.ActiveCfg = Release|Any CPU
- {81E8CBCD-6319-49E7-9662-0475BD0791F4}.Release|x86.Build.0 = Release|Any CPU
- {B2F6369A-D737-4AFD-8B81-9B094DB07DA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B2F6369A-D737-4AFD-8B81-9B094DB07DA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B2F6369A-D737-4AFD-8B81-9B094DB07DA7}.Debug|x64.ActiveCfg = Debug|Any CPU
- {B2F6369A-D737-4AFD-8B81-9B094DB07DA7}.Debug|x64.Build.0 = Debug|Any CPU
- {B2F6369A-D737-4AFD-8B81-9B094DB07DA7}.Debug|x86.ActiveCfg = Debug|Any CPU
- {B2F6369A-D737-4AFD-8B81-9B094DB07DA7}.Debug|x86.Build.0 = Debug|Any CPU
- {B2F6369A-D737-4AFD-8B81-9B094DB07DA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B2F6369A-D737-4AFD-8B81-9B094DB07DA7}.Release|Any CPU.Build.0 = Release|Any CPU
- {B2F6369A-D737-4AFD-8B81-9B094DB07DA7}.Release|x64.ActiveCfg = Release|Any CPU
- {B2F6369A-D737-4AFD-8B81-9B094DB07DA7}.Release|x64.Build.0 = Release|Any CPU
- {B2F6369A-D737-4AFD-8B81-9B094DB07DA7}.Release|x86.ActiveCfg = Release|Any CPU
- {B2F6369A-D737-4AFD-8B81-9B094DB07DA7}.Release|x86.Build.0 = Release|Any CPU
{3A5DDD20-5BD0-42F4-89F4-ACC0CE554028}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3A5DDD20-5BD0-42F4-89F4-ACC0CE554028}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A5DDD20-5BD0-42F4-89F4-ACC0CE554028}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -102,18 +72,6 @@ Global
{6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.Release|x64.Build.0 = Release|Any CPU
{6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.Release|x86.ActiveCfg = Release|Any CPU
{6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.Release|x86.Build.0 = Release|Any CPU
- {F8A0946A-5D25-4651-8079-B8D5776916FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F8A0946A-5D25-4651-8079-B8D5776916FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F8A0946A-5D25-4651-8079-B8D5776916FB}.Debug|x64.ActiveCfg = Debug|Any CPU
- {F8A0946A-5D25-4651-8079-B8D5776916FB}.Debug|x64.Build.0 = Debug|Any CPU
- {F8A0946A-5D25-4651-8079-B8D5776916FB}.Debug|x86.ActiveCfg = Debug|Any CPU
- {F8A0946A-5D25-4651-8079-B8D5776916FB}.Debug|x86.Build.0 = Debug|Any CPU
- {F8A0946A-5D25-4651-8079-B8D5776916FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F8A0946A-5D25-4651-8079-B8D5776916FB}.Release|Any CPU.Build.0 = Release|Any CPU
- {F8A0946A-5D25-4651-8079-B8D5776916FB}.Release|x64.ActiveCfg = Release|Any CPU
- {F8A0946A-5D25-4651-8079-B8D5776916FB}.Release|x64.Build.0 = Release|Any CPU
- {F8A0946A-5D25-4651-8079-B8D5776916FB}.Release|x86.ActiveCfg = Release|Any CPU
- {F8A0946A-5D25-4651-8079-B8D5776916FB}.Release|x86.Build.0 = Release|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -167,12 +125,9 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
- {81E8CBCD-6319-49E7-9662-0475BD0791F4} = {F594E7FD-1E72-4E51-A496-B019C2BA3180}
- {B2F6369A-D737-4AFD-8B81-9B094DB07DA7} = {F594E7FD-1E72-4E51-A496-B019C2BA3180}
{3A5DDD20-5BD0-42F4-89F4-ACC0CE554028} = {422E561A-8118-4BE7-A54F-9309E4F03AAE}
{8ED116F4-9DDF-4C49-AB96-AE462E3D64C3} = {422E561A-8118-4BE7-A54F-9309E4F03AAE}
{6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA} = {422E561A-8118-4BE7-A54F-9309E4F03AAE}
- {F8A0946A-5D25-4651-8079-B8D5776916FB} = {F594E7FD-1E72-4E51-A496-B019C2BA3180}
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4} = {422E561A-8118-4BE7-A54F-9309E4F03AAE}
{3B38E8DA-8BFF-4264-AF16-47929E6398A3} = {F594E7FD-1E72-4E51-A496-B019C2BA3180}
{29EEDF03-0990-45F4-846E-2616970D1FA2} = {F594E7FD-1E72-4E51-A496-B019C2BA3180}
diff --git a/module/PowerShellEditorServices.VSCode/PowerShellEditorServices.VSCode.psd1 b/module/PowerShellEditorServices.VSCode/PowerShellEditorServices.VSCode.psd1
index ddb9aa389..09ff913ff 100644
--- a/module/PowerShellEditorServices.VSCode/PowerShellEditorServices.VSCode.psd1
+++ b/module/PowerShellEditorServices.VSCode/PowerShellEditorServices.VSCode.psd1
@@ -9,7 +9,7 @@
@{
# Script module or binary module file associated with this manifest.
-RootModule = 'PowerShellEditorServices.VSCode.psm1'
+RootModule = "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.VSCode.dll"
# Version number of this module.
ModuleVersion = '0.2.0'
@@ -69,14 +69,14 @@ Description = 'Provides added functionality to PowerShell Editor Services for th
# NestedModules = @()
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
-FunctionsToExport = @('New-VSCodeHtmlContentView',
- 'Show-VSCodeHtmlContentView',
- 'Close-VSCodeHtmlContentView',
- 'Set-VSCodeHtmlContentView',
- 'Write-VSCodeHtmlContentView')
+FunctionsToExport = @()
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
-CmdletsToExport = @()
+CmdletsToExport = @('New-VSCodeHtmlContentView',
+ 'Show-VSCodeHtmlContentView',
+ 'Close-VSCodeHtmlContentView',
+ 'Set-VSCodeHtmlContentView',
+ 'Write-VSCodeHtmlContentView')
# Variables to export from this module
VariablesToExport = '*'
diff --git a/module/PowerShellEditorServices.VSCode/PowerShellEditorServices.VSCode.psm1 b/module/PowerShellEditorServices.VSCode/PowerShellEditorServices.VSCode.psm1
deleted file mode 100644
index 12b205c98..000000000
--- a/module/PowerShellEditorServices.VSCode/PowerShellEditorServices.VSCode.psm1
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Copyright (c) Microsoft. All rights reserved.
-# Licensed under the MIT license. See LICENSE file in the project root for full license information.
-#
-
-Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.VSCode.dll"
-
-if ($psEditor -is [Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorObject]) {
- [Microsoft.PowerShell.EditorServices.VSCode.ComponentRegistration]::Register($psEditor.Components)
-}
-else {
- Write-Verbose '$psEditor object not found in the session, components will not be registered.'
-}
-
-Microsoft.PowerShell.Management\Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -Recurse | ForEach-Object {
- . $PSItem.FullName
-}
diff --git a/module/PowerShellEditorServices.VSCode/Public/HtmlContentView/Close-VSCodeHtmlContentView.ps1 b/module/PowerShellEditorServices.VSCode/Public/HtmlContentView/Close-VSCodeHtmlContentView.ps1
deleted file mode 100644
index f8cf0c9c6..000000000
--- a/module/PowerShellEditorServices.VSCode/Public/HtmlContentView/Close-VSCodeHtmlContentView.ps1
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Copyright (c) Microsoft. All rights reserved.
-# Licensed under the MIT license. See LICENSE file in the project root for full license information.
-#
-
-function Close-VSCodeHtmlContentView {
- <#
- .SYNOPSIS
- Closes an HtmlContentView.
-
- .DESCRIPTION
- Closes an HtmlContentView inside of Visual Studio Code if
- it is displayed.
-
- .PARAMETER HtmlContentView
- The HtmlContentView to be closed.
-
- .EXAMPLE
- Close-VSCodeHtmlContentView -HtmlContentView $htmlContentView
- #>
- [CmdletBinding()]
- param (
- [Parameter(Mandatory = $true)]
- [Alias("View")]
- [ValidateNotNull()]
- [Microsoft.PowerShell.EditorServices.VSCode.CustomViews.IHtmlContentView]
- $HtmlContentView
- )
-
- process {
- $HtmlContentView.Close().Wait();
- }
-}
diff --git a/module/PowerShellEditorServices.VSCode/Public/HtmlContentView/New-VSCodeHtmlContentView.ps1 b/module/PowerShellEditorServices.VSCode/Public/HtmlContentView/New-VSCodeHtmlContentView.ps1
deleted file mode 100644
index d76c69fd4..000000000
--- a/module/PowerShellEditorServices.VSCode/Public/HtmlContentView/New-VSCodeHtmlContentView.ps1
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# Copyright (c) Microsoft. All rights reserved.
-# Licensed under the MIT license. See LICENSE file in the project root for full license information.
-#
-
-function New-VSCodeHtmlContentView {
- <#
- .SYNOPSIS
- Creates a custom view in Visual Studio Code which displays HTML content.
-
- .DESCRIPTION
- Creates a custom view in Visual Studio Code which displays HTML content.
-
- .PARAMETER Title
- The title of the view.
-
- .PARAMETER ShowInColumn
- If specified, causes the new view to be displayed in the specified column.
- If unspecified, the Show-VSCodeHtmlContentView cmdlet will need to be used
- to display the view.
-
- .EXAMPLE
- # Create a new view called "My Custom View"
- $htmlContentView = New-VSCodeHtmlContentView -Title "My Custom View"
-
- .EXAMPLE
- # Create a new view and show it in the second view column
- $htmlContentView = New-VSCodeHtmlContentView -Title "My Custom View" -ShowInColumn Two
- #>
- [CmdletBinding()]
- [OutputType([Microsoft.PowerShell.EditorServices.VSCode.CustomViews.IHtmlContentView])]
- param (
- [Parameter(Mandatory = $true)]
- [ValidateNotNullOrEmpty()]
- [string]
- $Title,
-
- [Parameter(Mandatory = $false)]
- [Microsoft.PowerShell.EditorServices.VSCode.CustomViews.ViewColumn]
- $ShowInColumn
- )
-
- process {
- if ($psEditor -is [Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorObject]) {
- $viewFeature = $psEditor.Components.Get([Microsoft.PowerShell.EditorServices.VSCode.CustomViews.IHtmlContentViews])
- $view = $viewFeature.CreateHtmlContentViewAsync($Title).Result
-
- if ($ShowInColumn) {
- $view.Show($ShowInColumn).Wait();
- }
-
- return $view
- }
- }
-}
diff --git a/module/PowerShellEditorServices.VSCode/Public/HtmlContentView/Set-VSCodeHtmlContentView.ps1 b/module/PowerShellEditorServices.VSCode/Public/HtmlContentView/Set-VSCodeHtmlContentView.ps1
deleted file mode 100644
index 98abf16a4..000000000
--- a/module/PowerShellEditorServices.VSCode/Public/HtmlContentView/Set-VSCodeHtmlContentView.ps1
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# Copyright (c) Microsoft. All rights reserved.
-# Licensed under the MIT license. See LICENSE file in the project root for full license information.
-#
-
-function Set-VSCodeHtmlContentView {
- <#
- .SYNOPSIS
- Sets the content of an HtmlContentView.
-
- .DESCRIPTION
- Sets the content of an HtmlContentView. If an empty string
- is passed, it causes the view's content to be cleared.
-
- .PARAMETER HtmlContentView
- The HtmlContentView where content will be set.
-
- .PARAMETER HtmlBodyContent
- The HTML content that will be placed inside the
tag
- of the view.
-
- .PARAMETER JavaScriptPaths
- An array of paths to JavaScript files that will be loaded
- into the view.
-
- .PARAMETER StyleSheetPaths
- An array of paths to stylesheet (CSS) files that will be
- loaded into the view.
-
- .EXAMPLE
- # Set the view content with an h1 header
- Set-VSCodeHtmlContentView -HtmlContentView $htmlContentView -HtmlBodyContent "Hello world! "
-
- .EXAMPLE
- # Clear the view
- Set-VSCodeHtmlContentView -View $htmlContentView -Content ""
- #>
- [CmdletBinding()]
- param (
- [Parameter(Mandatory = $true)]
- [Alias("View")]
- [ValidateNotNull()]
- [Microsoft.PowerShell.EditorServices.VSCode.CustomViews.IHtmlContentView]
- $HtmlContentView,
-
- [Parameter(Mandatory = $true)]
- [Alias("Content")]
- [AllowEmptyString()]
- [string]
- $HtmlBodyContent,
-
- [Parameter(Mandatory = $false)]
- [string[]]
- $JavaScriptPaths,
-
- [Parameter(Mandatory = $false)]
- [string[]]
- $StyleSheetPaths
- )
-
- process {
- $htmlContent = New-Object Microsoft.PowerShell.EditorServices.VSCode.CustomViews.HtmlContent
- $htmlContent.BodyContent = $HtmlBodyContent
- $htmlContent.JavaScriptPaths = $JavaScriptPaths
- $htmlContent.StyleSheetPaths = $StyleSheetPaths
-
- $HtmlContentView.SetContentAsync($htmlContent).Wait();
- }
-}
diff --git a/module/PowerShellEditorServices.VSCode/Public/HtmlContentView/Show-VSCodeHtmlContentView.ps1 b/module/PowerShellEditorServices.VSCode/Public/HtmlContentView/Show-VSCodeHtmlContentView.ps1
deleted file mode 100644
index 1be803471..000000000
--- a/module/PowerShellEditorServices.VSCode/Public/HtmlContentView/Show-VSCodeHtmlContentView.ps1
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Copyright (c) Microsoft. All rights reserved.
-# Licensed under the MIT license. See LICENSE file in the project root for full license information.
-#
-
-function Show-VSCodeHtmlContentView {
- <#
- .SYNOPSIS
- Shows an HtmlContentView.
-
- .DESCRIPTION
- Shows an HtmlContentView that has been created and not shown
- yet or has previously been closed.
-
- .PARAMETER HtmlContentView
- The HtmlContentView that will be shown.
-
- .PARAMETER ViewColumn
- If specified, causes the new view to be displayed in the specified column.
-
- .EXAMPLE
- # Shows the view in the first editor column
- Show-VSCodeHtmlContentView -HtmlContentView $htmlContentView
-
- .EXAMPLE
- # Shows the view in the third editor column
- Show-VSCodeHtmlContentView -View $htmlContentView -Column Three
- #>
- [CmdletBinding()]
- param (
- [Parameter(Mandatory = $true)]
- [Alias("View")]
- [ValidateNotNull()]
- [Microsoft.PowerShell.EditorServices.VSCode.CustomViews.IHtmlContentView]
- $HtmlContentView,
-
- [Parameter(Mandatory = $false)]
- [Alias("Column")]
- [ValidateNotNull()]
- [Microsoft.PowerShell.EditorServices.VSCode.CustomViews.ViewColumn]
- $ViewColumn = [Microsoft.PowerShell.EditorServices.VSCode.CustomViews.ViewColumn]::One
- )
-
- process {
- $HtmlContentView.Show($ViewColumn).Wait()
- }
-}
diff --git a/module/PowerShellEditorServices.VSCode/Public/HtmlContentView/Write-VSCodeHtmlContentView.ps1 b/module/PowerShellEditorServices.VSCode/Public/HtmlContentView/Write-VSCodeHtmlContentView.ps1
deleted file mode 100644
index c21321ec9..000000000
--- a/module/PowerShellEditorServices.VSCode/Public/HtmlContentView/Write-VSCodeHtmlContentView.ps1
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Copyright (c) Microsoft. All rights reserved.
-# Licensed under the MIT license. See LICENSE file in the project root for full license information.
-#
-
-function Write-VSCodeHtmlContentView {
- <#
- .SYNOPSIS
- Writes an HTML fragment to an HtmlContentView.
-
- .DESCRIPTION
- Writes an HTML fragment to an HtmlContentView. This new fragment
- is appended to the existing content, useful in cases where the
- output will be appended to an ongoing output stream.
-
- .PARAMETER HtmlContentView
- The HtmlContentView where content will be appended.
-
- .PARAMETER AppendedHtmlBodyContent
- The HTML content that will be appended to the view's element content.
-
- .EXAMPLE
- Write-VSCodeHtmlContentView -HtmlContentView $htmlContentView -AppendedHtmlBodyContent "Appended content "
-
- .EXAMPLE
- Write-VSCodeHtmlContentView -View $htmlContentView -Content "Appended content "
- #>
- [CmdletBinding()]
- param (
- [Parameter(Mandatory = $true)]
- [Alias("View")]
- [ValidateNotNull()]
- [Microsoft.PowerShell.EditorServices.VSCode.CustomViews.IHtmlContentView]
- $HtmlContentView,
-
- [Parameter(Mandatory = $true, ValueFromPipeline = $true)]
- [Alias("Content")]
- [ValidateNotNull()]
- [string]
- $AppendedHtmlBodyContent
- )
-
- process {
- $HtmlContentView.AppendContentAsync($AppendedHtmlBodyContent).Wait();
- }
-}
diff --git a/module/PowerShellEditorServices.VSCode/docs/Close-VSCodeHtmlContentView.md b/module/PowerShellEditorServices.VSCode/docs/Close-VSCodeHtmlContentView.md
new file mode 100644
index 000000000..559d4b9d1
--- /dev/null
+++ b/module/PowerShellEditorServices.VSCode/docs/Close-VSCodeHtmlContentView.md
@@ -0,0 +1,64 @@
+---
+external help file: Microsoft.PowerShell.EditorServices.VSCode.dll-Help.xml
+Module Name: PowerShellEditorServices.VSCode
+online version:
+schema: 2.0.0
+---
+
+# Close-VSCodeHtmlContentView
+
+## SYNOPSIS
+
+Closes an HtmlContentView.
+
+## SYNTAX
+
+```
+Close-VSCodeHtmlContentView [-HtmlContentView] []
+```
+
+## DESCRIPTION
+
+Closes an HtmlContentView inside of Visual Studio Code if it is displayed.
+
+## EXAMPLES
+
+### Example 1
+
+```powershell
+Close-VSCodeHtmlContentView -HtmlContentView $view
+```
+
+## PARAMETERS
+
+### -HtmlContentView
+
+The HtmlContentView to be closed.
+
+```yaml
+Type: IHtmlContentView
+Parameter Sets: (All)
+Aliases: View
+
+Required: True
+Position: 0
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+### None
+
+## OUTPUTS
+
+### System.Object
+
+## NOTES
+
+## RELATED LINKS
diff --git a/module/PowerShellEditorServices.VSCode/docs/New-VSCodeHtmlContentView.md b/module/PowerShellEditorServices.VSCode/docs/New-VSCodeHtmlContentView.md
new file mode 100644
index 000000000..ec837ddce
--- /dev/null
+++ b/module/PowerShellEditorServices.VSCode/docs/New-VSCodeHtmlContentView.md
@@ -0,0 +1,92 @@
+---
+external help file: Microsoft.PowerShell.EditorServices.VSCode.dll-Help.xml
+Module Name: PowerShellEditorServices.VSCode
+online version:
+schema: 2.0.0
+---
+
+# New-VSCodeHtmlContentView
+
+## SYNOPSIS
+
+Creates a custom view in Visual Studio Code which displays HTML content.
+
+## SYNTAX
+
+```
+New-VSCodeHtmlContentView [-Title] [[-ShowInColumn] ] []
+```
+
+## DESCRIPTION
+
+Creates a custom view in Visual Studio Code which displays HTML content.
+
+## EXAMPLES
+
+### Example 1
+
+```powershell
+$htmlContentView = New-VSCodeHtmlContentView -Title "My Custom View"
+```
+
+Create a new view called "My Custom View".
+
+### Example 2
+
+```powershell
+$htmlContentView = New-VSCodeHtmlContentView -Title "My Custom View" -ShowInColumn Two
+```
+
+Create a new view and show it in the second view column.
+
+## PARAMETERS
+
+### -ShowInColumn
+
+If specified, causes the new view to be displayed in the specified column.
+If unspecified, the Show-VSCodeHtmlContentView cmdlet will need to be used to display the view.
+
+```yaml
+Type: ViewColumn
+Parameter Sets: (All)
+Aliases:
+Accepted values: One, Two, Three
+
+Required: False
+Position: 1
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -Title
+
+The title of the view.
+
+```yaml
+Type: String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: 0
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+### None
+
+## OUTPUTS
+
+### Microsoft.PowerShell.EditorServices.VSCode.CustomViews.IHtmlContentView
+
+## NOTES
+
+## RELATED LINKS
diff --git a/module/PowerShellEditorServices.VSCode/docs/Set-VSCodeHtmlContentView.md b/module/PowerShellEditorServices.VSCode/docs/Set-VSCodeHtmlContentView.md
new file mode 100644
index 000000000..830ff42ac
--- /dev/null
+++ b/module/PowerShellEditorServices.VSCode/docs/Set-VSCodeHtmlContentView.md
@@ -0,0 +1,123 @@
+---
+external help file: Microsoft.PowerShell.EditorServices.VSCode.dll-Help.xml
+Module Name: PowerShellEditorServices.VSCode
+online version:
+schema: 2.0.0
+---
+
+# Set-VSCodeHtmlContentView
+
+## SYNOPSIS
+
+Sets the content of an HtmlContentView.
+
+## SYNTAX
+
+```
+Set-VSCodeHtmlContentView [-HtmlContentView] [-HtmlBodyContent]
+ [[-JavaScriptPaths] ] [[-StyleSheetPaths] ] []
+```
+
+## DESCRIPTION
+
+Sets the content of an HtmlContentView. If an empty string is passed, it causes the view's content to be cleared.
+
+## EXAMPLES
+
+### Example 1
+
+```powershell
+Set-VSCodeHtmlContentView -HtmlContentView $htmlContentView -HtmlBodyContent "Hello world! "
+```
+
+Set the view content with an h1 header.
+
+### Example 2
+
+```powershell
+Set-VSCodeHtmlContentView -View $htmlContentView -Content ""
+```
+
+Clear the view.
+
+## PARAMETERS
+
+### -HtmlBodyContent
+
+The HTML content that will be placed inside the `` tag of the view.
+
+```yaml
+Type: String
+Parameter Sets: (All)
+Aliases: Content
+
+Required: True
+Position: 1
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -HtmlContentView
+
+The HtmlContentView where content will be set.
+
+```yaml
+Type: IHtmlContentView
+Parameter Sets: (All)
+Aliases: View
+
+Required: True
+Position: 0
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -JavaScriptPaths
+
+An array of paths to JavaScript files that will be loaded into the view.
+
+```yaml
+Type: String[]
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: 2
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -StyleSheetPaths
+
+An array of paths to stylesheet (CSS) files that will be loaded into the view.
+
+```yaml
+Type: String[]
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: 3
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+### None
+
+## OUTPUTS
+
+### System.Object
+
+## NOTES
+
+## RELATED LINKS
diff --git a/module/PowerShellEditorServices.VSCode/docs/Show-VSCodeHtmlContentView.md b/module/PowerShellEditorServices.VSCode/docs/Show-VSCodeHtmlContentView.md
new file mode 100644
index 000000000..2659a3ead
--- /dev/null
+++ b/module/PowerShellEditorServices.VSCode/docs/Show-VSCodeHtmlContentView.md
@@ -0,0 +1,92 @@
+---
+external help file: Microsoft.PowerShell.EditorServices.VSCode.dll-Help.xml
+Module Name: PowerShellEditorServices.VSCode
+online version:
+schema: 2.0.0
+---
+
+# Show-VSCodeHtmlContentView
+
+## SYNOPSIS
+
+Shows an HtmlContentView.
+
+## SYNTAX
+
+```
+Show-VSCodeHtmlContentView [-HtmlContentView] [[-ViewColumn] ]
+ []
+```
+
+## DESCRIPTION
+
+Shows an HtmlContentView that has been created and not shown yet or has previously been closed.
+
+## EXAMPLES
+
+### Example 1
+
+```powershell
+Show-VSCodeHtmlContentView -HtmlContentView $htmlContentView
+```
+
+Shows the view in the first editor column.
+
+### Example 2
+
+```powershell
+Show-VSCodeHtmlContentView -View $htmlContentView -Column Three
+```
+
+Shows the view in the third editor column.
+
+## PARAMETERS
+
+### -HtmlContentView
+
+The HtmlContentView that will be shown.
+
+```yaml
+Type: IHtmlContentView
+Parameter Sets: (All)
+Aliases: View
+
+Required: True
+Position: 0
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ViewColumn
+
+If specified, causes the new view to be displayed in the specified column.
+
+```yaml
+Type: ViewColumn
+Parameter Sets: (All)
+Aliases: Column
+Accepted values: One, Two, Three
+
+Required: False
+Position: 1
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+### None
+
+## OUTPUTS
+
+### System.Object
+
+## NOTES
+
+## RELATED LINKS
diff --git a/module/PowerShellEditorServices.VSCode/docs/Write-VSCodeHtmlContentView.md b/module/PowerShellEditorServices.VSCode/docs/Write-VSCodeHtmlContentView.md
new file mode 100644
index 000000000..79c930da4
--- /dev/null
+++ b/module/PowerShellEditorServices.VSCode/docs/Write-VSCodeHtmlContentView.md
@@ -0,0 +1,87 @@
+---
+external help file: Microsoft.PowerShell.EditorServices.VSCode.dll-Help.xml
+Module Name: PowerShellEditorServices.VSCode
+online version:
+schema: 2.0.0
+---
+
+# Write-VSCodeHtmlContentView
+
+## SYNOPSIS
+
+Writes an HTML fragment to an HtmlContentView.
+
+## SYNTAX
+
+```
+Write-VSCodeHtmlContentView [-HtmlContentView] [-AppendedHtmlBodyContent]
+ []
+```
+
+## DESCRIPTION
+
+Writes an HTML fragment to an HtmlContentView. This new fragment is appended to the existing content, useful in cases where the output will be appended to an ongoing output stream.
+
+## EXAMPLES
+
+### Example 1
+
+```powershell
+Write-VSCodeHtmlContentView -HtmlContentView $htmlContentView -AppendedHtmlBodyContent "Appended content "
+```
+
+### Example 2
+
+```powershell
+Write-VSCodeHtmlContentView -View $htmlContentView -Content "Appended content "
+```
+
+## PARAMETERS
+
+### -AppendedHtmlBodyContent
+
+The HTML content that will be appended to the view's `` element content.
+
+```yaml
+Type: String
+Parameter Sets: (All)
+Aliases: Content
+
+Required: True
+Position: 1
+Default value: None
+Accept pipeline input: True (ByValue)
+Accept wildcard characters: False
+```
+
+### -HtmlContentView
+
+The HtmlContentView where content will be appended.
+
+```yaml
+Type: IHtmlContentView
+Parameter Sets: (All)
+Aliases: View
+
+Required: True
+Position: 0
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+### System.String
+
+## OUTPUTS
+
+### System.Object
+
+## NOTES
+
+## RELATED LINKS
diff --git a/src/PowerShellEditorServices.Channel.WebSocket/PowerShellEditorServices.Channel.WebSocket.csproj b/src/PowerShellEditorServices.Channel.WebSocket/PowerShellEditorServices.Channel.WebSocket.csproj
deleted file mode 100644
index 612263d23..000000000
--- a/src/PowerShellEditorServices.Channel.WebSocket/PowerShellEditorServices.Channel.WebSocket.csproj
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
- PowerShell Editor Services WebSocket Protocol Channel
- net452
- Microsoft.PowerShell.EditorServices.Channel.WebSocket
-
-
-
-
-
-
-
-
-
- 10.0.3
-
-
-
-
-
-
-
-
-
-
-
- $(DefineConstants);CoreCLR
-
-
-
-
-
-
-
diff --git a/src/PowerShellEditorServices.Channel.WebSocket/WebsocketClientChannel.cs b/src/PowerShellEditorServices.Channel.WebSocket/WebsocketClientChannel.cs
deleted file mode 100644
index edf2fd52f..000000000
--- a/src/PowerShellEditorServices.Channel.WebSocket/WebsocketClientChannel.cs
+++ /dev/null
@@ -1,163 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System;
-using System.IO;
-using System.Linq;
-using System.Net.WebSockets;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.Channel;
-using Microsoft.PowerShell.EditorServices.Utility;
-
-namespace Microsoft.PowerShell.EditorServices.Channel.WebSocket
-{
- ///
- /// Implementation of that enables WebSocket communication.
- ///
- public class WebsocketClientChannel : ChannelBase
- {
- private readonly string serverUrl;
- private ClientWebSocket socket;
- private ClientWebSocketStream inputStream;
- private ClientWebSocketStream outputStream;
-
- ///
- /// Gets the process ID of the server process.
- ///
- public int ProcessId { get; private set; }
-
- ///
- /// Initializes an instance of the WebsocketClientChannel.
- ///
- /// The full path to the server process executable.
- public WebsocketClientChannel(string url)
- {
- this.serverUrl = url;
- }
-
- public override async Task WaitForConnectionAsync()
- {
- try
- {
- await this.socket.ConnectAsync(new Uri(serverUrl), CancellationToken.None);
- }
- catch (AggregateException ex)
- {
- var wsException= ex.InnerExceptions.FirstOrDefault() as WebSocketException;
- if (wsException != null)
- {
- Logger.Write(LogLevel.Warning,
- string.Format("Failed to connect to WebSocket server. Error was '{0}'", wsException.Message));
-
- }
-
- throw;
- }
-
- this.IsConnected = true;
- }
-
- protected override void Initialize(IMessageSerializer messageSerializer)
- {
- this.socket = new ClientWebSocket();
- this.inputStream = new ClientWebSocketStream(socket);
- this.outputStream = new ClientWebSocketStream(socket);
-
- // Set up the message reader and writer
- this.MessageReader =
- new MessageReader(
- this.inputStream,
- messageSerializer);
-
- this.MessageWriter =
- new MessageWriter(
- this.outputStream,
- messageSerializer);
- }
-
- protected override void Shutdown()
- {
- if (this.MessageReader != null)
- {
- this.MessageReader = null;
- }
-
- if (this.MessageWriter != null)
- {
- this.MessageWriter = null;
- }
-
- if (this.socket != null)
- {
- socket.Dispose();
- }
- }
- }
-
- ///
- /// Extension of that sends data to a WebSocket during FlushAsync
- /// and reads during WriteAsync.
- ///
- internal class ClientWebSocketStream : MemoryStream
- {
- private readonly ClientWebSocket socket;
-
- ///
- /// Constructor
- ///
- ///
- /// It is expected that the socket is in an Open state.
- ///
- ///
- public ClientWebSocketStream(ClientWebSocket socket)
- {
- this.socket = socket;
- }
-
- ///
- /// Reads from the WebSocket.
- ///
- ///
- ///
- ///
- ///
- ///
- public override async Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
- {
- if (socket.State != WebSocketState.Open)
- {
- return 0;
- }
-
- WebSocketReceiveResult result;
- do
- {
- result = await socket.ReceiveAsync(new ArraySegment(buffer, offset, count), cancellationToken);
- } while (!result.EndOfMessage);
-
- if (result.MessageType == WebSocketMessageType.Close)
- {
- await socket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Closing", cancellationToken);
- return 0;
- }
-
- return result.Count;
- }
-
- ///
- /// Sends the data in the stream to the buffer and clears the stream.
- ///
- ///
- ///
- public override async Task FlushAsync(CancellationToken cancellationToken)
- {
- await socket.SendAsync(new ArraySegment(ToArray()), WebSocketMessageType.Binary, true, cancellationToken);
- SetLength(0);
- }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Channel.WebSocket/WebsocketServerChannel.cs b/src/PowerShellEditorServices.Channel.WebSocket/WebsocketServerChannel.cs
deleted file mode 100644
index c3cb907de..000000000
--- a/src/PowerShellEditorServices.Channel.WebSocket/WebsocketServerChannel.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System;
-using System.IO;
-using System.Linq;
-using System.Net.WebSockets;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.Channel;
-using Microsoft.PowerShell.EditorServices.Protocol.Server;
-using Owin.WebSocket;
-
-namespace Microsoft.PowerShell.EditorServices.Channel.WebSocket
-{
- ///
- /// Implementation of that implements the streams necessary for
- /// communicating via OWIN WebSockets.
- ///
- public class WebSocketServerChannel : ChannelBase
- {
- private MemoryStream inStream;
- private readonly WebSocketConnection socketConnection;
-
- public WebSocketServerChannel(WebSocketConnection socket)
- {
- socketConnection = socket;
- }
-
- protected override void Initialize(IMessageSerializer messageSerializer)
- {
- inStream = new MemoryStream();
-
- // Set up the reader and writer
- this.MessageReader =
- new MessageReader(
- this.inStream,
- messageSerializer);
-
- this.MessageWriter =
- new MessageWriter(
- new WebSocketStream(socketConnection),
- messageSerializer);
- }
-
- ///
- /// Dispatches data received during calls to OnMessageReceivedAsync in the class.
- ///
- ///
- /// This method calls an overriden version of the that dispatches messages on
- /// demand rather than running on a background thread.
- ///
- ///
- ///
- public async Task DispatchAsync(ArraySegment message)
- {
- //Clear our stream
- inStream.SetLength(0);
-
- //Write data and dispatch to handlers
- await inStream.WriteAsync(message.ToArray(), 0, message.Count);
- inStream.Position = 0;
- }
-
- protected override void Shutdown()
- {
- this.socketConnection.Close(WebSocketCloseStatus.NormalClosure, "Server shutting down");
- }
-
- public override Task WaitForConnectionAsync()
- {
- // TODO: Need to update behavior here
- return Task.FromResult(true);
- }
- }
-
- ///
- /// Overriden that sends data through a during the FlushAsync call.
- ///
- ///
- /// FlushAsync will send data via the SendBinary method of the class. The memory streams length will
- /// then be set to 0 to reset the stream for additional data to be written.
- ///
- internal class WebSocketStream : MemoryStream
- {
- private readonly WebSocketConnection _connection;
-
- public WebSocketStream(WebSocketConnection connection)
- {
- _connection = connection;
- }
-
- public override async Task FlushAsync(CancellationToken cancellationToken)
- {
- //Send to client socket and reset stream
- await _connection.SendBinary(new ArraySegment(ToArray()), true);
- SetLength(0);
- }
- }
-
- ///
- /// Base class for WebSocket connections that expose editor services.
- ///
- public abstract class EditorServiceWebSocketConnection : WebSocketConnection
- {
- protected EditorServiceWebSocketConnection()
- {
- Channel = new WebSocketServerChannel(this);
- }
-
- protected ProtocolEndpoint Server { get; set; }
-
- protected WebSocketServerChannel Channel { get; private set; }
-
- public override void OnOpen()
- {
- Server.Start();
- }
-
- public override async Task OnMessageReceivedAsync(ArraySegment message, WebSocketMessageType type)
- {
- await Channel.DispatchAsync(message);
- }
-
- public override Task OnCloseAsync(WebSocketCloseStatus? closeStatus, string closeStatusDescription)
- {
- Server.Stop();
-
- return base.OnCloseAsync(closeStatus, closeStatusDescription);
- }
- }
-
- ///
- /// Web socket connections that expose the .
- ///
- public class LanguageServerWebSocketConnection : EditorServiceWebSocketConnection
- {
- public LanguageServerWebSocketConnection()
- {
- Server = new LanguageServer(null, null, Channel);
- }
- }
-
- ///
- /// Web socket connections that expose the .
- ///
- public class DebugAdapterWebSocketConnection : EditorServiceWebSocketConnection
- {
- public DebugAdapterWebSocketConnection()
- {
- Server = new DebugAdapter(null, null, Channel, null);
- }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Engine/BuildInfo.cs b/src/PowerShellEditorServices.Engine/BuildInfo.cs
deleted file mode 100644
index 47c020fbf..000000000
--- a/src/PowerShellEditorServices.Engine/BuildInfo.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-namespace Microsoft.PowerShell.EditorServices.Engine
-{
- public static class BuildInfo
- {
- public const string BuildVersion = "";
- public const string BuildOrigin = "";
- public static readonly System.DateTime? BuildTime;
- }
-}
diff --git a/src/PowerShellEditorServices.Engine/Services/PowerShellContext/Extensions/EditorObject.cs b/src/PowerShellEditorServices.Engine/Services/PowerShellContext/Extensions/EditorObject.cs
index a9643104f..3522debb4 100644
--- a/src/PowerShellEditorServices.Engine/Services/PowerShellContext/Extensions/EditorObject.cs
+++ b/src/PowerShellEditorServices.Engine/Services/PowerShellContext/Extensions/EditorObject.cs
@@ -42,6 +42,11 @@ public Version EditorServicesVersion
///
public EditorWindow Window { get; private set; }
+ ///
+ /// Gets the components that are registered.
+ ///
+ public IServiceProvider Components => _serviceProvider;
+
#endregion
///
diff --git a/src/PowerShellEditorServices.Host/App.config b/src/PowerShellEditorServices.Host/App.config
deleted file mode 100644
index 066f94c5f..000000000
--- a/src/PowerShellEditorServices.Host/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/src/PowerShellEditorServices.Host/CodeLens/CodeLensExtensions.cs b/src/PowerShellEditorServices.Host/CodeLens/CodeLensExtensions.cs
deleted file mode 100644
index c3be72bfe..000000000
--- a/src/PowerShellEditorServices.Host/CodeLens/CodeLensExtensions.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System.Management.Automation.Language;
-using Microsoft.PowerShell.EditorServices.CodeLenses;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using LanguageServer = Microsoft.PowerShell.EditorServices.Protocol.LanguageServer;
-
-namespace Microsoft.PowerShell.EditorServices
-{
- public static class ICodeLensExtensions
- {
- public static LanguageServer.CodeLens ToProtocolCodeLens(
- this CodeLens codeLens,
- JsonSerializer jsonSerializer)
- {
- return new LanguageServer.CodeLens
- {
- Range = codeLens.ScriptExtent.ToRange(),
- Command = codeLens.Command.ToProtocolCommand(jsonSerializer)
- };
- }
-
- public static LanguageServer.CodeLens ToProtocolCodeLens(
- this CodeLens codeLens,
- object codeLensData,
- JsonSerializer jsonSerializer)
- {
- LanguageServer.ServerCommand command = null;
-
- if (codeLens.Command != null)
- {
- command = codeLens.Command.ToProtocolCommand(jsonSerializer);
- }
-
- return new LanguageServer.CodeLens
- {
- Range = codeLens.ScriptExtent.ToRange(),
- Data = JToken.FromObject(codeLensData, jsonSerializer),
- Command = command
- };
- }
- }
-}
diff --git a/src/PowerShellEditorServices.Host/CodeLens/CodeLensFeature.cs b/src/PowerShellEditorServices.Host/CodeLens/CodeLensFeature.cs
deleted file mode 100644
index d90d77333..000000000
--- a/src/PowerShellEditorServices.Host/CodeLens/CodeLensFeature.cs
+++ /dev/null
@@ -1,203 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Components;
-using Microsoft.PowerShell.EditorServices.Protocol.LanguageServer;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using Microsoft.PowerShell.EditorServices.Utility;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-
-using LanguageServer = Microsoft.PowerShell.EditorServices.Protocol.LanguageServer;
-
-namespace Microsoft.PowerShell.EditorServices.CodeLenses
-{
- ///
- /// Implements the CodeLens feature for EditorServices.
- ///
- internal class CodeLensFeature :
- FeatureComponentBase,
- ICodeLenses
- {
-
- ///
- /// Create a new CodeLens instance around a given editor session
- /// from the component registry.
- ///
- ///
- /// The component registry to provider other components and to register the CodeLens provider in.
- ///
- /// The editor session context of the CodeLens provider.
- /// A new CodeLens provider for the given editor session.
- public static CodeLensFeature Create(
- IComponentRegistry components,
- EditorSession editorSession)
- {
- var codeLenses =
- new CodeLensFeature(
- editorSession,
- JsonSerializer.Create(Constants.JsonSerializerSettings),
- components.Get());
-
- var messageHandlers = components.Get();
-
- messageHandlers.SetRequestHandler(
- CodeLensRequest.Type,
- codeLenses.HandleCodeLensRequestAsync);
-
- messageHandlers.SetRequestHandler(
- CodeLensResolveRequest.Type,
- codeLenses.HandleCodeLensResolveRequestAsync);
-
- codeLenses.Providers.Add(
- new ReferencesCodeLensProvider(
- editorSession));
-
- codeLenses.Providers.Add(
- new PesterCodeLensProvider(
- editorSession));
-
- editorSession.Components.Register(codeLenses);
-
- return codeLenses;
- }
-
- ///
- /// The editor session context to get workspace and language server data from.
- ///
- private readonly EditorSession _editorSession;
-
- ///
- /// The json serializer instance for CodeLens object translation.
- ///
- private readonly JsonSerializer _jsonSerializer;
-
- ///
- ///
- ///
- ///
- ///
- ///
- private CodeLensFeature(
- EditorSession editorSession,
- JsonSerializer jsonSerializer,
- ILogger logger)
- : base(logger)
- {
- _editorSession = editorSession;
- _jsonSerializer = jsonSerializer;
- }
-
- ///
- /// Get all the CodeLenses for a given script file.
- ///
- /// The PowerShell script file to get CodeLenses for.
- /// All generated CodeLenses for the given script file.
- public CodeLens[] ProvideCodeLenses(ScriptFile scriptFile)
- {
- return InvokeProviders(provider => provider.ProvideCodeLenses(scriptFile))
- .SelectMany(codeLens => codeLens)
- .ToArray();
- }
-
- ///
- /// Handles a request for CodeLenses from VSCode.
- ///
- /// Parameters on the CodeLens request that was received.
- ///
- private async Task HandleCodeLensRequestAsync(
- CodeLensRequest codeLensParams,
- RequestContext requestContext)
- {
- ScriptFile scriptFile = _editorSession.Workspace.GetFile(
- codeLensParams.TextDocument.Uri);
-
- CodeLens[] codeLensResults = ProvideCodeLenses(scriptFile);
-
- var codeLensResponse = new LanguageServer.CodeLens[codeLensResults.Length];
- for (int i = 0; i < codeLensResults.Length; i++)
- {
- codeLensResponse[i] = codeLensResults[i].ToProtocolCodeLens(
- new CodeLensData
- {
- Uri = codeLensResults[i].File.DocumentUri,
- ProviderId = codeLensResults[i].Provider.ProviderId
- },
- _jsonSerializer);
- }
-
- await requestContext.SendResultAsync(codeLensResponse);
- }
-
- ///
- /// Handle a CodeLens resolve request from VSCode.
- ///
- /// The CodeLens to be resolved/updated.
- ///
- private async Task HandleCodeLensResolveRequestAsync(
- LanguageServer.CodeLens codeLens,
- RequestContext requestContext)
- {
- if (codeLens.Data != null)
- {
- // TODO: Catch deserializtion exception on bad object
- CodeLensData codeLensData = codeLens.Data.ToObject();
-
- ICodeLensProvider originalProvider =
- Providers.FirstOrDefault(
- provider => provider.ProviderId.Equals(codeLensData.ProviderId));
-
- if (originalProvider != null)
- {
- ScriptFile scriptFile =
- _editorSession.Workspace.GetFile(
- codeLensData.Uri);
-
- ScriptRegion region = new ScriptRegion
- {
- StartLineNumber = codeLens.Range.Start.Line + 1,
- StartColumnNumber = codeLens.Range.Start.Character + 1,
- EndLineNumber = codeLens.Range.End.Line + 1,
- EndColumnNumber = codeLens.Range.End.Character + 1
- };
-
- CodeLens originalCodeLens =
- new CodeLens(
- originalProvider,
- scriptFile,
- region);
-
- var resolvedCodeLens =
- await originalProvider.ResolveCodeLensAsync(
- originalCodeLens,
- CancellationToken.None);
-
- await requestContext.SendResultAsync(
- resolvedCodeLens.ToProtocolCodeLens(
- _jsonSerializer));
- }
- else
- {
- await requestContext.SendErrorAsync(
- $"Could not find provider for the original CodeLens: {codeLensData.ProviderId}");
- }
- }
- }
-
- ///
- /// Represents data expected back in an LSP CodeLens response.
- ///
- private class CodeLensData
- {
- public string Uri { get; set; }
-
- public string ProviderId {get; set; }
- }
- }
-}
diff --git a/src/PowerShellEditorServices.Host/CodeLens/IScriptExtentExtensions.cs b/src/PowerShellEditorServices.Host/CodeLens/IScriptExtentExtensions.cs
deleted file mode 100644
index ca8f49d54..000000000
--- a/src/PowerShellEditorServices.Host/CodeLens/IScriptExtentExtensions.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System.Management.Automation.Language;
-using Microsoft.PowerShell.EditorServices.Protocol.LanguageServer;
-
-namespace Microsoft.PowerShell.EditorServices
-{
- public static class IScriptExtentExtensions
- {
- public static Range ToRange(this IScriptExtent scriptExtent)
- {
- return new Range
- {
- Start = new Position
- {
- Line = scriptExtent.StartLineNumber - 1,
- Character = scriptExtent.StartColumnNumber - 1
- },
- End = new Position
- {
- Line = scriptExtent.EndLineNumber - 1,
- Character = scriptExtent.EndColumnNumber - 1
- }
- };
- }
- }
-}
diff --git a/src/PowerShellEditorServices.Host/CodeLens/PesterCodeLensProvider.cs b/src/PowerShellEditorServices.Host/CodeLens/PesterCodeLensProvider.cs
deleted file mode 100644
index cc4a706b0..000000000
--- a/src/PowerShellEditorServices.Host/CodeLens/PesterCodeLensProvider.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.PowerShell.EditorServices.Commands;
-using Microsoft.PowerShell.EditorServices.Symbols;
-
-namespace Microsoft.PowerShell.EditorServices.CodeLenses
-{
- internal class PesterCodeLensProvider : FeatureProviderBase, ICodeLensProvider
- {
- ///
- /// The editor session context to provide CodeLenses for.
- ///
- private EditorSession _editorSession;
-
- ///
- /// The symbol provider to get symbols from to build code lenses with.
- ///
- private IDocumentSymbolProvider _symbolProvider;
-
- ///
- /// Create a new Pester CodeLens provider for a given editor session.
- ///
- /// The editor session context for which to provide Pester CodeLenses.
- public PesterCodeLensProvider(EditorSession editorSession)
- {
- _editorSession = editorSession;
- _symbolProvider = new PesterDocumentSymbolProvider();
- }
-
- ///
- /// Get the Pester CodeLenses for a given Pester symbol.
- ///
- /// The Pester symbol to get CodeLenses for.
- /// The script file the Pester symbol comes from.
- /// All CodeLenses for the given Pester symbol.
- private CodeLens[] GetPesterLens(PesterSymbolReference pesterSymbol, ScriptFile scriptFile)
- {
- var codeLensResults = new CodeLens[]
- {
- new CodeLens(
- this,
- scriptFile,
- pesterSymbol.ScriptRegion,
- new ClientCommand(
- "PowerShell.RunPesterTests",
- "Run tests",
- new object[] {
- scriptFile.DocumentUri,
- false /* No debug */,
- pesterSymbol.TestName,
- pesterSymbol.ScriptRegion?.StartLineNumber })),
-
- new CodeLens(
- this,
- scriptFile,
- pesterSymbol.ScriptRegion,
- new ClientCommand(
- "PowerShell.RunPesterTests",
- "Debug tests",
- new object[] {
- scriptFile.DocumentUri,
- true /* Run in the debugger */,
- pesterSymbol.TestName,
- pesterSymbol.ScriptRegion?.StartLineNumber })),
- };
-
- return codeLensResults;
- }
-
- ///
- /// Get all Pester CodeLenses for a given script file.
- ///
- /// The script file to get Pester CodeLenses for.
- /// All Pester CodeLenses for the given script file.
- public CodeLens[] ProvideCodeLenses(ScriptFile scriptFile)
- {
- var lenses = new List();
- foreach (SymbolReference symbol in _symbolProvider.ProvideDocumentSymbols(scriptFile))
- {
- if (symbol is PesterSymbolReference pesterSymbol)
- {
- if (pesterSymbol.Command != PesterCommandType.Describe)
- {
- continue;
- }
-
- lenses.AddRange(GetPesterLens(pesterSymbol, scriptFile));
- }
- }
-
- return lenses.ToArray();
- }
-
- ///
- /// Resolve the CodeLens provision asynchronously -- just wraps the CodeLens argument in a task.
- ///
- /// The code lens to resolve.
- ///
- /// The given CodeLens, wrapped in a task.
- public Task ResolveCodeLensAsync(CodeLens codeLens, CancellationToken cancellationToken)
- {
- // This provider has no specific behavior for
- // resolving CodeLenses.
- return Task.FromResult(codeLens);
- }
- }
-}
diff --git a/src/PowerShellEditorServices.Host/CodeLens/ReferencesCodeLensProvider.cs b/src/PowerShellEditorServices.Host/CodeLens/ReferencesCodeLensProvider.cs
deleted file mode 100644
index 69edb6cc3..000000000
--- a/src/PowerShellEditorServices.Host/CodeLens/ReferencesCodeLensProvider.cs
+++ /dev/null
@@ -1,177 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.PowerShell.EditorServices.Commands;
-using Microsoft.PowerShell.EditorServices.Protocol.LanguageServer;
-using Microsoft.PowerShell.EditorServices.Symbols;
-
-namespace Microsoft.PowerShell.EditorServices.CodeLenses
-{
- ///
- /// Provides the "reference" code lens by extracting document symbols.
- ///
- internal class ReferencesCodeLensProvider : FeatureProviderBase, ICodeLensProvider
- {
- private static readonly Location[] s_emptyLocationArray = new Location[0];
-
- ///
- /// The editor session code lenses are being provided from.
- ///
- private EditorSession _editorSession;
-
- ///
- /// The document symbol provider to supply symbols to generate the code lenses.
- ///
- private IDocumentSymbolProvider _symbolProvider;
-
- ///
- /// Construct a new ReferencesCodeLensProvider for a given EditorSession.
- ///
- ///
- public ReferencesCodeLensProvider(EditorSession editorSession)
- {
- _editorSession = editorSession;
-
- // TODO: Pull this from components
- _symbolProvider = new ScriptDocumentSymbolProvider(
- editorSession.PowerShellContext.LocalPowerShellVersion.Version);
- }
-
- ///
- /// Get all reference code lenses for a given script file.
- ///
- /// The PowerShell script file to get code lenses for.
- /// An array of CodeLenses describing all functions in the given script file.
- public CodeLens[] ProvideCodeLenses(ScriptFile scriptFile)
- {
- var acc = new List();
- foreach (SymbolReference sym in _symbolProvider.ProvideDocumentSymbols(scriptFile))
- {
- if (sym.SymbolType == SymbolType.Function)
- {
- acc.Add(new CodeLens(this, scriptFile, sym.ScriptRegion));
- }
- }
-
- return acc.ToArray();
- }
-
- ///
- /// Take a codelens and create a new codelens object with updated references.
- ///
- /// The old code lens to get updated references for.
- /// The cancellation token for this request.
- /// A new code lens object describing the same data as the old one but with updated references.
- public async Task ResolveCodeLensAsync(
- CodeLens codeLens,
- CancellationToken cancellationToken)
- {
- ScriptFile[] references = _editorSession.Workspace.ExpandScriptReferences(
- codeLens.File);
-
- SymbolReference foundSymbol = _editorSession.LanguageService.FindFunctionDefinitionAtLocation(
- codeLens.File,
- codeLens.ScriptExtent.StartLineNumber,
- codeLens.ScriptExtent.StartColumnNumber);
-
- FindReferencesResult referencesResult = await _editorSession.LanguageService.FindReferencesOfSymbolAsync(
- foundSymbol,
- references,
- _editorSession.Workspace);
-
- Location[] referenceLocations;
- if (referencesResult == null)
- {
- referenceLocations = s_emptyLocationArray;
- }
- else
- {
- var acc = new List();
- foreach (SymbolReference foundReference in referencesResult.FoundReferences)
- {
- if (!NotReferenceDefinition(foundSymbol, foundReference))
- {
- continue;
- }
-
- acc.Add(new Location
- {
- Uri = GetFileUri(foundReference.FilePath),
- Range = foundReference.ScriptRegion.ToRange()
- });
- }
- referenceLocations = acc.ToArray();
- }
-
- return new CodeLens(
- codeLens,
- new ClientCommand(
- "editor.action.showReferences",
- GetReferenceCountHeader(referenceLocations.Length),
- new object[]
- {
- codeLens.File.DocumentUri,
- codeLens.ScriptExtent.ToRange().Start,
- referenceLocations,
- }
- ));
- }
-
- ///
- /// Check whether a SymbolReference is not a reference to another defined symbol.
- ///
- /// The symbol definition that may be referenced.
- /// The reference symbol to check.
- /// True if the reference is not a reference to the definition, false otherwise.
- private static bool NotReferenceDefinition(
- SymbolReference definition,
- SymbolReference reference)
- {
- return
- definition.ScriptRegion.StartLineNumber != reference.ScriptRegion.StartLineNumber
- || definition.SymbolType != reference.SymbolType
- || !string.Equals(definition.SymbolName, reference.SymbolName, StringComparison.OrdinalIgnoreCase);
- }
-
- ///
- /// Get a URI for a given file path.
- ///
- /// A file path that may be prefixed with URI scheme already.
- /// A URI to the file.
- private static string GetFileUri(string filePath)
- {
- // If the file isn't untitled, return a URI-style path
- return
- !filePath.StartsWith("untitled") && !filePath.StartsWith("inmemory")
- ? Workspace.ConvertPathToDocumentUri(filePath)
- : filePath;
- }
-
- ///
- /// Get the code lens header for the number of references on a definition,
- /// given the number of references.
- ///
- /// The number of references found for a given definition.
- /// The header string for the reference code lens.
- private static string GetReferenceCountHeader(int referenceCount)
- {
- if (referenceCount == 1)
- {
- return "1 reference";
- }
-
- var sb = new StringBuilder(14); // "100 references".Length = 14
- sb.Append(referenceCount);
- sb.Append(" references");
- return sb.ToString();
- }
- }
-}
diff --git a/src/PowerShellEditorServices.Host/Commands/ClientCommandExtensions.cs b/src/PowerShellEditorServices.Host/Commands/ClientCommandExtensions.cs
deleted file mode 100644
index 95594d9b6..000000000
--- a/src/PowerShellEditorServices.Host/Commands/ClientCommandExtensions.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Commands;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-
-using LanguageServer = Microsoft.PowerShell.EditorServices.Protocol.LanguageServer;
-
-namespace Microsoft.PowerShell.EditorServices
-{
- public static class ClientCommandExtensions
- {
- public static LanguageServer.ServerCommand ToProtocolCommand(
- this ClientCommand clientCommand,
- JsonSerializer jsonSerializer)
- {
- return new LanguageServer.ServerCommand
- {
- Command = clientCommand.Name,
- Title = clientCommand.Title,
- Arguments =
- JArray.FromObject(
- clientCommand.Arguments,
- jsonSerializer)
- };
- }
- }
-}
diff --git a/src/PowerShellEditorServices.Host/EditorServicesHost.cs b/src/PowerShellEditorServices.Host/EditorServicesHost.cs
deleted file mode 100644
index 15ace52f8..000000000
--- a/src/PowerShellEditorServices.Host/EditorServicesHost.cs
+++ /dev/null
@@ -1,563 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Components;
-using Microsoft.PowerShell.EditorServices.CodeLenses;
-using Microsoft.PowerShell.EditorServices.Extensions;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.Channel;
-using Microsoft.PowerShell.EditorServices.Protocol.Server;
-using Microsoft.PowerShell.EditorServices.Session;
-using Microsoft.PowerShell.EditorServices.Symbols;
-using Microsoft.PowerShell.EditorServices.Utility;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Management.Automation;
-using System.Management.Automation.Runspaces;
-using System.Management.Automation.Host;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
-
-namespace Microsoft.PowerShell.EditorServices.Host
-{
- public enum EditorServicesHostStatus
- {
- Started,
- Failed,
- Ended
- }
-
- public enum EditorServiceTransportType
- {
- NamedPipe,
- Stdio
- }
-
- public class EditorServiceTransportConfig
- {
- public EditorServiceTransportType TransportType { get; set; }
- ///
- /// Configures the endpoint of the transport.
- /// For Stdio it's ignored.
- /// For NamedPipe it's the pipe name.
- ///
- public string InOutPipeName { get; set; }
-
- public string OutPipeName { get; set; }
-
- public string InPipeName { get; set; }
-
- internal string Endpoint => OutPipeName != null && InPipeName != null ? $"In pipe: {InPipeName} Out pipe: {OutPipeName}" : $" InOut pipe: {InOutPipeName}";
- }
-
- ///
- /// Provides a simplified interface for hosting the language and debug services
- /// over the named pipe server protocol.
- ///
- public class EditorServicesHost
- {
- #region Private Fields
-
- private readonly PSHost internalHost;
- private string[] additionalModules;
- private string bundledModulesPath;
- private DebugAdapter debugAdapter;
- private EditorSession editorSession;
- private bool enableConsoleRepl;
- private HashSet featureFlags;
- private HostDetails hostDetails;
- private LanguageServer languageServer;
- private ILogger logger;
- private ProfilePaths profilePaths;
- private TaskCompletionSource serverCompletedTask;
-
- private IServerListener languageServiceListener;
- private IServerListener debugServiceListener;
-
- #endregion
-
- #region Properties
-
- public EditorServicesHostStatus Status { get; private set; }
-
- #endregion
-
- #region Constructors
-
- ///
- /// Initializes a new instance of the EditorServicesHost class and waits for
- /// the debugger to attach if waitForDebugger is true.
- ///
- /// The details of the host which is launching PowerShell Editor Services.
- /// Provides a path to PowerShell modules bundled with the host, if any. Null otherwise.
- /// If true, causes the host to wait for the debugger to attach before proceeding.
- /// Modules to be loaded when initializing the new runspace.
- /// Features to enable for this instance.
- public EditorServicesHost(
- HostDetails hostDetails,
- string bundledModulesPath,
- bool enableConsoleRepl,
- bool waitForDebugger,
- string[] additionalModules,
- string[] featureFlags)
- : this(
- hostDetails,
- bundledModulesPath,
- enableConsoleRepl,
- waitForDebugger,
- additionalModules,
- featureFlags,
- GetInternalHostFromDefaultRunspace())
- {
- }
-
- ///
- /// Initializes a new instance of the EditorServicesHost class and waits for
- /// the debugger to attach if waitForDebugger is true.
- ///
- /// The details of the host which is launching PowerShell Editor Services.
- /// Provides a path to PowerShell modules bundled with the host, if any. Null otherwise.
- /// If true, causes the host to wait for the debugger to attach before proceeding.
- /// Modules to be loaded when initializing the new runspace.
- /// Features to enable for this instance.
- /// The value of the $Host variable in the original runspace.
- public EditorServicesHost(
- HostDetails hostDetails,
- string bundledModulesPath,
- bool enableConsoleRepl,
- bool waitForDebugger,
- string[] additionalModules,
- string[] featureFlags,
- PSHost internalHost)
- {
- Validate.IsNotNull(nameof(hostDetails), hostDetails);
- Validate.IsNotNull(nameof(internalHost), internalHost);
-
- this.hostDetails = hostDetails;
- this.enableConsoleRepl = enableConsoleRepl;
- this.bundledModulesPath = bundledModulesPath;
- this.additionalModules = additionalModules ?? new string[0];
- this.featureFlags = new HashSet(featureFlags ?? new string[0]);
- this.serverCompletedTask = new TaskCompletionSource();
- this.internalHost = internalHost;
-
- while (!System.Diagnostics.Debugger.IsAttached)
- {
- System.Console.WriteLine(System.Diagnostics.Process.GetCurrentProcess().Id);
- System.Threading.Thread.Sleep(2000);
- }
-
-#if DEBUG
- if (waitForDebugger)
- {
- if (System.Diagnostics.Debugger.IsAttached)
- {
- System.Diagnostics.Debugger.Break();
- }
- else
- {
- System.Diagnostics.Debugger.Launch();
- }
- }
-#endif
-
- // Catch unhandled exceptions for logging purposes
- AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
- }
-
- #endregion
-
- #region Public Methods
-
- ///
- /// Starts the Logger for the specified file path and log level.
- ///
- /// The path of the log file to be written.
- /// The minimum level of log messages to be written.
- public void StartLogging(string logFilePath, LogLevel logLevel)
- {
- this.logger = Logging.CreateLogger()
- .LogLevel(logLevel)
- .AddLogFile(logFilePath)
- .Build();
-
- FileVersionInfo fileVersionInfo =
- FileVersionInfo.GetVersionInfo(this.GetType().GetTypeInfo().Assembly.Location);
-
- string osVersion = RuntimeInformation.OSDescription;
-
- string osArch = GetOSArchitecture();
-
- string buildTime = BuildInfo.BuildTime?.ToString("s", System.Globalization.CultureInfo.InvariantCulture) ?? "";
-
- string logHeader = $@"
-PowerShell Editor Services Host v{fileVersionInfo.FileVersion} starting (PID {Process.GetCurrentProcess().Id}
-
- Host application details:
-
- Name: {this.hostDetails.Name}
- Version: {this.hostDetails.Version}
- ProfileId: {this.hostDetails.ProfileId}
- Arch: {osArch}
-
- Operating system details:
-
- Version: {osVersion}
- Arch: {osArch}
-
- Build information:
-
- Version: {BuildInfo.BuildVersion}
- Origin: {BuildInfo.BuildOrigin}
- Date: {buildTime}
-";
-
- this.logger.Write(LogLevel.Normal, logHeader);
- }
-
- ///
- /// Starts the language service with the specified config.
- ///
- /// The config that contains information on the communication protocol that will be used.
- /// The profiles that will be loaded in the session.
- public void StartLanguageService(
- EditorServiceTransportConfig config,
- ProfilePaths profilePaths)
- {
- this.profilePaths = profilePaths;
-
- this.languageServiceListener = CreateServiceListener(MessageProtocolType.LanguageServer, config);
-
- this.languageServiceListener.ClientConnect += this.OnLanguageServiceClientConnectAsync;
- this.languageServiceListener.Start();
-
- this.logger.Write(
- LogLevel.Normal,
- string.Format(
- "Language service started, type = {0}, endpoint = {1}",
- config.TransportType, config.Endpoint));
- }
-
- private async void OnLanguageServiceClientConnectAsync(
- object sender,
- ChannelBase serverChannel)
- {
- MessageDispatcher messageDispatcher = new MessageDispatcher(this.logger);
-
- ProtocolEndpoint protocolEndpoint =
- new ProtocolEndpoint(
- serverChannel,
- messageDispatcher,
- this.logger);
-
- protocolEndpoint.UnhandledException += ProtocolEndpoint_UnhandledException;
-
- this.editorSession =
- CreateSession(
- this.hostDetails,
- this.profilePaths,
- protocolEndpoint,
- messageDispatcher,
- this.enableConsoleRepl);
-
- this.languageServer =
- new LanguageServer(
- this.editorSession,
- messageDispatcher,
- protocolEndpoint,
- this.serverCompletedTask,
- this.logger);
-
- await this.editorSession.PowerShellContext.ImportCommandsModuleAsync(
- Path.Combine(
- Path.GetDirectoryName(this.GetType().GetTypeInfo().Assembly.Location),
- @"..\Commands"));
-
- this.languageServer.Start();
-
- // TODO: This can be moved to the point after the $psEditor object
- // gets initialized when that is done earlier than LanguageServer.Initialize
- foreach (string module in this.additionalModules)
- {
- var command =
- new System.Management.Automation.PSCommand()
- .AddCommand("Microsoft.PowerShell.Core\\Import-Module")
- .AddParameter("Name", module);
-
- await this.editorSession.PowerShellContext.ExecuteCommandAsync(
- command,
- sendOutputToHost: false,
- sendErrorToHost: true);
- }
-
- protocolEndpoint.Start();
- }
-
- ///
- /// Starts the debug service with the specified config.
- ///
- /// The config that contains information on the communication protocol that will be used.
- /// The profiles that will be loaded in the session.
- /// Determines if we will reuse the session that we have.
- public void StartDebugService(
- EditorServiceTransportConfig config,
- ProfilePaths profilePaths,
- bool useExistingSession)
- {
- this.debugServiceListener = CreateServiceListener(MessageProtocolType.DebugAdapter, config);
- this.debugServiceListener.ClientConnect += OnDebugServiceClientConnect;
- this.debugServiceListener.Start();
-
- this.logger.Write(
- LogLevel.Normal,
- string.Format(
- "Debug service started, type = {0}, endpoint = {1}",
- config.TransportType, config.Endpoint));
- }
-
- private void OnDebugServiceClientConnect(object sender, ChannelBase serverChannel)
- {
- MessageDispatcher messageDispatcher = new MessageDispatcher(this.logger);
-
- ProtocolEndpoint protocolEndpoint =
- new ProtocolEndpoint(
- serverChannel,
- messageDispatcher,
- this.logger);
-
- protocolEndpoint.UnhandledException += ProtocolEndpoint_UnhandledException;
-
- bool ownsEditorSession = this.editorSession == null;
-
- if (ownsEditorSession)
- {
- this.editorSession =
- this.CreateDebugSession(
- this.hostDetails,
- profilePaths,
- protocolEndpoint,
- messageDispatcher,
- this.languageServer?.EditorOperations,
- this.enableConsoleRepl);
- }
-
- this.debugAdapter =
- new DebugAdapter(
- this.editorSession,
- ownsEditorSession,
- messageDispatcher,
- protocolEndpoint,
- this.logger);
-
- this.debugAdapter.SessionEnded +=
- (obj, args) =>
- {
- if (!ownsEditorSession)
- {
- this.logger.Write(
- LogLevel.Normal,
- "Previous debug session ended, restarting debug service listener...");
- this.debugServiceListener.Stop();
- this.debugServiceListener.Start();
- }
- else if (this.debugAdapter.IsUsingTempIntegratedConsole)
- {
- this.logger.Write(
- LogLevel.Normal,
- "Previous temp debug session ended");
- }
- else
- {
- // Exit the host process
- this.serverCompletedTask.SetResult(true);
- }
- };
-
- this.debugAdapter.Start();
- protocolEndpoint.Start();
- }
-
- ///
- /// Stops the language or debug services if either were started.
- ///
- public void StopServices()
- {
- // TODO: Need a new way to shut down the services
-
- this.languageServer = null;
-
- this.debugAdapter = null;
- }
-
- ///
- /// Waits for either the language or debug service to shut down.
- ///
- public void WaitForCompletion()
- {
- // TODO: We need a way to know when to complete this task!
- this.serverCompletedTask.Task.Wait();
- }
-
- #endregion
-
- #region Private Methods
-
- private static PSHost GetInternalHostFromDefaultRunspace()
- {
- using (var pwsh = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace))
- {
- return pwsh.AddScript("$Host").Invoke().First();
- }
- }
-
- private EditorSession CreateSession(
- HostDetails hostDetails,
- ProfilePaths profilePaths,
- IMessageSender messageSender,
- IMessageHandlers messageHandlers,
- bool enableConsoleRepl)
- {
- EditorSession editorSession = new EditorSession(this.logger);
- PowerShellContext powerShellContext = new PowerShellContext(this.logger, this.featureFlags.Contains("PSReadLine"));
-
- EditorServicesPSHostUserInterface hostUserInterface =
- enableConsoleRepl
- ? (EditorServicesPSHostUserInterface) new TerminalPSHostUserInterface(powerShellContext, this.logger, this.internalHost)
- : new ProtocolPSHostUserInterface(powerShellContext, messageSender, this.logger);
-
- EditorServicesPSHost psHost =
- new EditorServicesPSHost(
- powerShellContext,
- hostDetails,
- hostUserInterface,
- this.logger);
-
- Runspace initialRunspace = PowerShellContext.CreateRunspace(psHost);
- powerShellContext.Initialize(profilePaths, initialRunspace, true, hostUserInterface);
-
- editorSession.StartSession(powerShellContext, hostUserInterface);
-
- // TODO: Move component registrations elsewhere!
- editorSession.Components.Register(this.logger);
- editorSession.Components.Register(messageHandlers);
- editorSession.Components.Register(messageSender);
- editorSession.Components.Register(powerShellContext);
-
- CodeLensFeature.Create(editorSession.Components, editorSession);
- DocumentSymbolFeature.Create(editorSession.Components, editorSession);
-
- return editorSession;
- }
-
- private EditorSession CreateDebugSession(
- HostDetails hostDetails,
- ProfilePaths profilePaths,
- IMessageSender messageSender,
- IMessageHandlers messageHandlers,
- IEditorOperations editorOperations,
- bool enableConsoleRepl)
- {
- EditorSession editorSession = new EditorSession(this.logger);
- PowerShellContext powerShellContext = new PowerShellContext(
- this.logger,
- this.featureFlags.Contains("PSReadLine"));
-
- EditorServicesPSHostUserInterface hostUserInterface =
- enableConsoleRepl
- ? (EditorServicesPSHostUserInterface) new TerminalPSHostUserInterface(powerShellContext, this.logger, this.internalHost)
- : new ProtocolPSHostUserInterface(powerShellContext, messageSender, this.logger);
-
- EditorServicesPSHost psHost =
- new EditorServicesPSHost(
- powerShellContext,
- hostDetails,
- hostUserInterface,
- this.logger);
-
- Runspace initialRunspace = PowerShellContext.CreateRunspace(psHost);
- powerShellContext.Initialize(profilePaths, initialRunspace, true, hostUserInterface);
-
- editorSession.StartDebugSession(
- powerShellContext,
- hostUserInterface,
- editorOperations);
-
- return editorSession;
- }
-
- private void ProtocolEndpoint_UnhandledException(object sender, Exception e)
- {
- this.logger.Write(
- LogLevel.Error,
- "PowerShell Editor Services is terminating due to an unhandled exception, see previous logs for details.");
-
- this.serverCompletedTask.SetException(e);
- }
-
- private void CurrentDomain_UnhandledException(
- object sender,
- UnhandledExceptionEventArgs e)
- {
- // Log the exception
- this.logger.Write(LogLevel.Error, $"FATAL UNHANDLED EXCEPTION: {e.ExceptionObject}");
- }
-
- private IServerListener CreateServiceListener(MessageProtocolType protocol, EditorServiceTransportConfig config)
- {
- switch (config.TransportType)
- {
- case EditorServiceTransportType.Stdio:
- {
- return new StdioServerListener(protocol, this.logger);
- }
-
- case EditorServiceTransportType.NamedPipe:
- {
- if ((config.OutPipeName != null) && (config.InPipeName != null))
- {
- this.logger.Write(LogLevel.Verbose, $"Creating NamedPipeServerListener for ${protocol} protocol with two pipes: In: '{config.InPipeName}'. Out: '{config.OutPipeName}'");
- return new NamedPipeServerListener(protocol, config.InPipeName, config.OutPipeName, this.logger);
- }
- else
- {
- return new NamedPipeServerListener(protocol, config.InOutPipeName, this.logger);
- }
- }
-
- default:
- {
- throw new NotSupportedException();
- }
- }
- }
-
- ///
- /// Gets the OSArchitecture for logging. Cannot use System.Runtime.InteropServices.RuntimeInformation.OSArchitecture
- /// directly, since this tries to load API set DLLs in win7 and crashes.
- ///
- ///
- private string GetOSArchitecture()
- {
- // If on win7 (version 6.1.x), avoid System.Runtime.InteropServices.RuntimeInformation
- if (Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version < new Version(6, 2))
- {
- if (Environment.Is64BitProcess)
- {
- return "X64";
- }
-
- return "X86";
- }
-
- return RuntimeInformation.OSArchitecture.ToString();
- }
-
- #endregion
- }
-}
diff --git a/src/PowerShellEditorServices.Host/PSHost/PromptHandlers.cs b/src/PowerShellEditorServices.Host/PSHost/PromptHandlers.cs
deleted file mode 100644
index d8ec88c4e..000000000
--- a/src/PowerShellEditorServices.Host/PSHost/PromptHandlers.cs
+++ /dev/null
@@ -1,185 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System;
-using Microsoft.PowerShell.EditorServices.Console;
-using Microsoft.PowerShell.EditorServices.Protocol.Messages;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using Microsoft.PowerShell.EditorServices.Utility;
-using System.Threading.Tasks;
-using System.Threading;
-using System.Security;
-
-namespace Microsoft.PowerShell.EditorServices.Host
-{
- internal class ProtocolChoicePromptHandler : ConsoleChoicePromptHandler
- {
- private IHostInput hostInput;
- private IMessageSender messageSender;
- private TaskCompletionSource readLineTask;
-
- public ProtocolChoicePromptHandler(
- IMessageSender messageSender,
- IHostInput hostInput,
- IHostOutput hostOutput,
- ILogger logger)
- : base(hostOutput, logger)
- {
- this.hostInput = hostInput;
- this.hostOutput = hostOutput;
- this.messageSender = messageSender;
- }
-
- protected override void ShowPrompt(PromptStyle promptStyle)
- {
- base.ShowPrompt(promptStyle);
-
- messageSender
- .SendRequestAsync(
- ShowChoicePromptRequest.Type,
- new ShowChoicePromptRequest
- {
- IsMultiChoice = this.IsMultiChoice,
- Caption = this.Caption,
- Message = this.Message,
- Choices = this.Choices,
- DefaultChoices = this.DefaultChoices
- }, true)
- .ContinueWith(HandlePromptResponse)
- .ConfigureAwait(false);
- }
-
- protected override Task ReadInputStringAsync(CancellationToken cancellationToken)
- {
- this.readLineTask = new TaskCompletionSource();
- return this.readLineTask.Task;
- }
-
- private void HandlePromptResponse(
- Task responseTask)
- {
- if (responseTask.IsCompleted)
- {
- ShowChoicePromptResponse response = responseTask.Result;
-
- if (!response.PromptCancelled)
- {
- this.hostOutput.WriteOutput(
- response.ResponseText,
- OutputType.Normal);
-
- this.readLineTask.TrySetResult(response.ResponseText);
- }
- else
- {
- // Cancel the current prompt
- this.hostInput.SendControlC();
- }
- }
- else
- {
- if (responseTask.IsFaulted)
- {
- // Log the error
- Logger.Write(
- LogLevel.Error,
- "ShowChoicePrompt request failed with error:\r\n{0}",
- responseTask.Exception.ToString());
- }
-
- // Cancel the current prompt
- this.hostInput.SendControlC();
- }
-
- this.readLineTask = null;
- }
- }
-
- internal class ProtocolInputPromptHandler : ConsoleInputPromptHandler
- {
- private IHostInput hostInput;
- private IMessageSender messageSender;
- private TaskCompletionSource readLineTask;
-
- public ProtocolInputPromptHandler(
- IMessageSender messageSender,
- IHostInput hostInput,
- IHostOutput hostOutput,
- ILogger logger)
- : base(hostOutput, logger)
- {
- this.hostInput = hostInput;
- this.hostOutput = hostOutput;
- this.messageSender = messageSender;
- }
-
- protected override void ShowFieldPrompt(FieldDetails fieldDetails)
- {
- base.ShowFieldPrompt(fieldDetails);
-
- messageSender
- .SendRequestAsync(
- ShowInputPromptRequest.Type,
- new ShowInputPromptRequest
- {
- Name = fieldDetails.Name,
- Label = fieldDetails.Label
- }, true)
- .ContinueWith(HandlePromptResponse)
- .ConfigureAwait(false);
- }
-
- protected override Task ReadInputStringAsync(CancellationToken cancellationToken)
- {
- this.readLineTask = new TaskCompletionSource();
- return this.readLineTask.Task;
- }
-
- private void HandlePromptResponse(
- Task responseTask)
- {
- if (responseTask.IsCompleted)
- {
- ShowInputPromptResponse response = responseTask.Result;
-
- if (!response.PromptCancelled)
- {
- this.hostOutput.WriteOutput(
- response.ResponseText,
- OutputType.Normal);
-
- this.readLineTask.TrySetResult(response.ResponseText);
- }
- else
- {
- // Cancel the current prompt
- this.hostInput.SendControlC();
- }
- }
- else
- {
- if (responseTask.IsFaulted)
- {
- // Log the error
- Logger.Write(
- LogLevel.Error,
- "ShowInputPrompt request failed with error:\r\n{0}",
- responseTask.Exception.ToString());
- }
-
- // Cancel the current prompt
- this.hostInput.SendControlC();
- }
-
- this.readLineTask = null;
- }
-
- protected override Task ReadSecureStringAsync(CancellationToken cancellationToken)
- {
- // TODO: Write a message to the console
- throw new NotImplementedException();
- }
- }
-}
diff --git a/src/PowerShellEditorServices.Host/PSHost/ProtocolPSHostUserInterface.cs b/src/PowerShellEditorServices.Host/PSHost/ProtocolPSHostUserInterface.cs
deleted file mode 100644
index 76b1f7252..000000000
--- a/src/PowerShellEditorServices.Host/PSHost/ProtocolPSHostUserInterface.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Console;
-using Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using Microsoft.PowerShell.EditorServices.Protocol.Server;
-using Microsoft.PowerShell.EditorServices.Utility;
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Microsoft.PowerShell.EditorServices.Host
-{
- internal class ProtocolPSHostUserInterface : EditorServicesPSHostUserInterface
- {
- #region Private Fields
-
- private IMessageSender messageSender;
- private OutputDebouncer outputDebouncer;
-
- #endregion
-
- #region Constructors
-
- ///
- /// Creates a new instance of the ConsoleServicePSHostUserInterface
- /// class with the given IConsoleHost implementation.
- ///
- ///
- public ProtocolPSHostUserInterface(
- PowerShellContext powerShellContext,
- IMessageSender messageSender,
- ILogger logger)
- : base(powerShellContext, new SimplePSHostRawUserInterface(logger), logger)
- {
- this.messageSender = messageSender;
- this.outputDebouncer = new OutputDebouncer(messageSender);
- }
-
- public void Dispose()
- {
- // TODO: Need a clear API path for this
-
- // Make sure remaining output is flushed before exiting
- if (this.outputDebouncer != null)
- {
- this.outputDebouncer.FlushAsync().Wait();
- this.outputDebouncer = null;
- }
- }
-
- #endregion
-
- ///
- /// Writes output of the given type to the user interface with
- /// the given foreground and background colors. Also includes
- /// a newline if requested.
- ///
- ///
- /// The output string to be written.
- ///
- ///
- /// If true, a newline should be appended to the output's contents.
- ///
- ///
- /// Specifies the type of output to be written.
- ///
- ///
- /// Specifies the foreground color of the output to be written.
- ///
- ///
- /// Specifies the background color of the output to be written.
- ///
- public override void WriteOutput(
- string outputString,
- bool includeNewLine,
- OutputType outputType,
- ConsoleColor foregroundColor,
- ConsoleColor backgroundColor)
- {
- // TODO: This should use a synchronous method!
- this.outputDebouncer.InvokeAsync(
- new OutputWrittenEventArgs(
- outputString,
- includeNewLine,
- outputType,
- foregroundColor,
- backgroundColor)).Wait();
- }
-
- ///
- /// Sends a progress update event to the user.
- ///
- /// The source ID of the progress event.
- /// The details of the activity's current progress.
- protected override void UpdateProgress(
- long sourceId,
- ProgressDetails progressDetails)
- {
- }
-
- protected override Task ReadCommandLineAsync(CancellationToken cancellationToken)
- {
- // This currently does nothing because the "evaluate" request
- // will cancel the current prompt and execute the user's
- // script selection.
- return new TaskCompletionSource().Task;
- }
-
- protected override InputPromptHandler OnCreateInputPromptHandler()
- {
- return new ProtocolInputPromptHandler(this.messageSender, this, this, this.Logger);
- }
-
- protected override ChoicePromptHandler OnCreateChoicePromptHandler()
- {
- return new ProtocolChoicePromptHandler(this.messageSender, this, this, this.Logger);
- }
- }
-}
diff --git a/src/PowerShellEditorServices.Host/PowerShellEditorServices.Host.csproj b/src/PowerShellEditorServices.Host/PowerShellEditorServices.Host.csproj
deleted file mode 100644
index 2245a4a22..000000000
--- a/src/PowerShellEditorServices.Host/PowerShellEditorServices.Host.csproj
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- PowerShell Editor Services Host Process
- Provides a process for hosting the PowerShell Editor Services library exposed by a JSON message protocol.
- netstandard2.0
- Microsoft.PowerShell.EditorServices.Host
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/PowerShellEditorServices.Host/Symbols/DocumentSymbolFeature.cs b/src/PowerShellEditorServices.Host/Symbols/DocumentSymbolFeature.cs
deleted file mode 100644
index da3402bde..000000000
--- a/src/PowerShellEditorServices.Host/Symbols/DocumentSymbolFeature.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Components;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using Microsoft.PowerShell.EditorServices.Protocol.LanguageServer;
-using Microsoft.PowerShell.EditorServices.Utility;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-
-using Servers = Microsoft.PowerShell.EditorServices.Protocol.Server;
-
-namespace Microsoft.PowerShell.EditorServices.Symbols
-{
- internal class DocumentSymbolFeature :
- FeatureComponentBase,
- IDocumentSymbols
- {
- private EditorSession editorSession;
-
- public DocumentSymbolFeature(
- EditorSession editorSession,
- IMessageHandlers messageHandlers,
- ILogger logger)
- : base(logger)
- {
- this.editorSession = editorSession;
-
- messageHandlers.SetRequestHandler(
- DocumentSymbolRequest.Type,
- this.HandleDocumentSymbolRequestAsync);
- }
-
- public static DocumentSymbolFeature Create(
- IComponentRegistry components,
- EditorSession editorSession)
- {
- var documentSymbols =
- new DocumentSymbolFeature(
- editorSession,
- components.Get(),
- components.Get());
-
- documentSymbols.Providers.Add(
- new ScriptDocumentSymbolProvider(
- editorSession.PowerShellContext.LocalPowerShellVersion.Version));
-
- documentSymbols.Providers.Add(
- new PsdDocumentSymbolProvider());
-
- documentSymbols.Providers.Add(
- new PesterDocumentSymbolProvider());
-
- editorSession.Components.Register(documentSymbols);
-
- return documentSymbols;
- }
-
- public IEnumerable ProvideDocumentSymbols(
- ScriptFile scriptFile)
- {
- return
- this.InvokeProviders(p => p.ProvideDocumentSymbols(scriptFile))
- .SelectMany(r => r);
- }
-
- protected async Task HandleDocumentSymbolRequestAsync(
- DocumentSymbolParams documentSymbolParams,
- RequestContext requestContext)
- {
- ScriptFile scriptFile =
- editorSession.Workspace.GetFile(
- documentSymbolParams.TextDocument.Uri);
-
- IEnumerable foundSymbols =
- this.ProvideDocumentSymbols(scriptFile);
-
- SymbolInformation[] symbols = null;
-
- string containerName = Path.GetFileNameWithoutExtension(scriptFile.FilePath);
-
- if (foundSymbols != null)
- {
- symbols =
- foundSymbols
- .Select(r =>
- {
- return new SymbolInformation
- {
- ContainerName = containerName,
- Kind = Servers.LanguageServer.GetSymbolKind(r.SymbolType),
- Location = new Location
- {
- Uri = Servers.LanguageServer.GetFileUri(r.FilePath),
- Range = Servers.LanguageServer.GetRangeFromScriptRegion(r.ScriptRegion)
- },
- Name = Servers.LanguageServer.GetDecoratedSymbolName(r)
- };
- })
- .ToArray();
- }
- else
- {
- symbols = new SymbolInformation[0];
- }
-
- await requestContext.SendResultAsync(symbols);
- }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/Client/DebugAdapterClientBase.cs b/src/PowerShellEditorServices.Protocol/Client/DebugAdapterClientBase.cs
deleted file mode 100644
index b226fd0c4..000000000
--- a/src/PowerShellEditorServices.Protocol/Client/DebugAdapterClientBase.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.Channel;
-using Microsoft.PowerShell.EditorServices.Utility;
-using System.Threading.Tasks;
-using System;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.Client
-{
- public class DebugAdapterClient : IMessageSender, IMessageHandlers
- {
- private ILogger logger;
- private ProtocolEndpoint protocolEndpoint;
- private MessageDispatcher messageDispatcher;
-
- public DebugAdapterClient(ChannelBase clientChannel, ILogger logger)
- {
- this.logger = logger;
- this.messageDispatcher = new MessageDispatcher(logger);
- this.protocolEndpoint = new ProtocolEndpoint(
- clientChannel,
- messageDispatcher,
- logger);
- }
-
- public async Task StartAsync()
- {
- this.protocolEndpoint.Start();
-
- // Initialize the debug adapter
- await this.SendRequestAsync(
- InitializeRequest.Type,
- new InitializeRequestArguments
- {
- LinesStartAt1 = true,
- ColumnsStartAt1 = true
- },
- true);
- }
-
- public void Stop()
- {
- this.protocolEndpoint.Stop();
- }
-
- public async Task LaunchScriptAsync(string scriptFilePath)
- {
- await this.SendRequestAsync(
- LaunchRequest.Type,
- new LaunchRequestArguments {
- Script = scriptFilePath
- },
- true);
-
- await this.SendRequestAsync(
- ConfigurationDoneRequest.Type,
- null,
- true);
- }
-
- public Task SendEventAsync(NotificationType eventType, TParams eventParams)
- {
- return ((IMessageSender)protocolEndpoint).SendEventAsync(eventType, eventParams);
- }
-
- public Task SendRequestAsync(RequestType requestType, TParams requestParams, bool waitForResponse)
- {
- return ((IMessageSender)protocolEndpoint).SendRequestAsync(requestType, requestParams, waitForResponse);
- }
-
- public Task SendRequestAsync(RequestType0 requestType0)
- {
- return ((IMessageSender)protocolEndpoint).SendRequestAsync(requestType0);
- }
-
- public void SetRequestHandler(RequestType requestType, Func, Task> requestHandler)
- {
- ((IMessageHandlers)messageDispatcher).SetRequestHandler(requestType, requestHandler);
- }
-
- public void SetRequestHandler(RequestType0 requestType0, Func, Task> requestHandler)
- {
- ((IMessageHandlers)messageDispatcher).SetRequestHandler(requestType0, requestHandler);
- }
-
- public void SetEventHandler(NotificationType eventType, Func eventHandler)
- {
- ((IMessageHandlers)messageDispatcher).SetEventHandler(eventType, eventHandler);
- }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/Client/LanguageClientBase.cs b/src/PowerShellEditorServices.Protocol/Client/LanguageClientBase.cs
deleted file mode 100644
index 0ccb3d5b5..000000000
--- a/src/PowerShellEditorServices.Protocol/Client/LanguageClientBase.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.LanguageServer;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.Channel;
-using Microsoft.PowerShell.EditorServices.Utility;
-using System;
-using System.Threading.Tasks;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.Client
-{
- ///
- /// Provides a base implementation for language server clients.
- ///
- public abstract class LanguageClientBase : IMessageHandlers, IMessageSender
- {
- ILogger logger;
- private ProtocolEndpoint protocolEndpoint;
- private MessageDispatcher messageDispatcher;
-
- ///
- /// Initializes an instance of the language client using the
- /// specified channel for communication.
- ///
- /// The channel to use for communication with the server.
- public LanguageClientBase(ChannelBase clientChannel, ILogger logger)
- {
- this.logger = logger;
- this.messageDispatcher = new MessageDispatcher(logger);
- this.protocolEndpoint = new ProtocolEndpoint(
- clientChannel,
- messageDispatcher,
- logger);
- }
-
- public Task Start()
- {
- this.protocolEndpoint.Start();
-
- // Initialize the implementation class
- return this.InitializeAsync();
- }
-
- public async Task StopAsync()
- {
- await this.OnStopAsync();
-
- // First, notify the language server that we're stopping
- var response =
- await this.SendRequestAsync(
- ShutdownRequest.Type);
-
- await this.SendEventAsync(ExitNotification.Type, new object());
-
- this.protocolEndpoint.Stop();
- }
-
- protected virtual Task OnStopAsync()
- {
- return Task.FromResult(true);
- }
-
- protected virtual Task InitializeAsync()
- {
- return Task.FromResult(true);
- }
-
- public Task SendEventAsync(NotificationType eventType, TParams eventParams)
- {
- return ((IMessageSender)protocolEndpoint).SendEventAsync(eventType, eventParams);
- }
-
- public Task SendRequestAsync(RequestType requestType, TParams requestParams, bool waitForResponse)
- {
- return ((IMessageSender)protocolEndpoint).SendRequestAsync(requestType, requestParams, waitForResponse);
- }
-
- public Task SendRequestAsync(RequestType0 requestType0)
- {
- return ((IMessageSender)protocolEndpoint).SendRequestAsync(requestType0);
- }
-
- public void SetRequestHandler(RequestType requestType, Func, Task> requestHandler)
- {
- ((IMessageHandlers)messageDispatcher).SetRequestHandler(requestType, requestHandler);
- }
-
- public void SetRequestHandler(RequestType0 requestType0, Func, Task> requestHandler)
- {
- ((IMessageHandlers)messageDispatcher).SetRequestHandler(requestType0, requestHandler);
- }
-
- public void SetEventHandler(NotificationType eventType, Func eventHandler)
- {
- ((IMessageHandlers)messageDispatcher).SetEventHandler(eventType, eventHandler);
- }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/Client/LanguageServiceClient.cs b/src/PowerShellEditorServices.Protocol/Client/LanguageServiceClient.cs
deleted file mode 100644
index e2b1491fd..000000000
--- a/src/PowerShellEditorServices.Protocol/Client/LanguageServiceClient.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.LanguageServer;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.Channel;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.PowerShell.EditorServices.Utility;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.Client
-{
- public class LanguageServiceClient : LanguageClientBase
- {
- private Dictionary cachedDiagnostics =
- new Dictionary();
-
- public LanguageServiceClient(ChannelBase clientChannel, ILogger logger)
- : base(clientChannel, logger)
- {
- }
-
- protected override Task InitializeAsync()
- {
- // Add handlers for common events
- this.SetEventHandler(PublishDiagnosticsNotification.Type, HandlePublishDiagnosticsEventAsync);
-
- // Send the 'initialize' request and wait for the response
- var initializeParams = new InitializeParams
- {
- RootPath = "",
- Capabilities = new ClientCapabilities()
- };
-
- return this.SendRequestAsync(
- InitializeRequest.Type,
- initializeParams,
- true);
- }
-
- #region Events
-
- public event EventHandler DiagnosticsReceived;
-
- protected void OnDiagnosticsReceived(string filePath)
- {
- if (this.DiagnosticsReceived != null)
- {
- this.DiagnosticsReceived(this, filePath);
- }
- }
-
- #endregion
-
- #region Private Methods
-
- private Task HandlePublishDiagnosticsEventAsync(
- PublishDiagnosticsNotification diagnostics,
- EventContext eventContext)
- {
- string normalizedPath = diagnostics.Uri.ToLower();
-
- this.cachedDiagnostics[normalizedPath] =
- diagnostics.Diagnostics
- .Select(GetMarkerFromDiagnostic)
- .ToArray();
-
- this.OnDiagnosticsReceived(normalizedPath);
-
- return Task.FromResult(true);
- }
-
- private static ScriptFileMarker GetMarkerFromDiagnostic(Diagnostic diagnostic)
- {
- DiagnosticSeverity severity =
- diagnostic.Severity.GetValueOrDefault(
- DiagnosticSeverity.Error);
-
- return new ScriptFileMarker
- {
- Level = MapDiagnosticSeverityToLevel(severity),
- Message = diagnostic.Message,
- ScriptRegion = new ScriptRegion
- {
- StartLineNumber = diagnostic.Range.Start.Line + 1,
- StartColumnNumber = diagnostic.Range.Start.Character + 1,
- EndLineNumber = diagnostic.Range.End.Line + 1,
- EndColumnNumber = diagnostic.Range.End.Character + 1
- }
- };
- }
-
- private static ScriptFileMarkerLevel MapDiagnosticSeverityToLevel(DiagnosticSeverity severity)
- {
- switch (severity)
- {
- case DiagnosticSeverity.Hint:
- case DiagnosticSeverity.Information:
- return ScriptFileMarkerLevel.Information;
-
- case DiagnosticSeverity.Warning:
- return ScriptFileMarkerLevel.Warning;
-
- case DiagnosticSeverity.Error:
- return ScriptFileMarkerLevel.Error;
-
- default:
- return ScriptFileMarkerLevel.Error;
- }
- }
-
- #endregion
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/AttachRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/AttachRequest.cs
deleted file mode 100644
index 4c805a2b1..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/AttachRequest.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class AttachRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("attach");
- }
-
- public class AttachRequestArguments
- {
- public string ComputerName { get; set; }
-
- public string ProcessId { get; set; }
-
- public string RunspaceId { get; set; }
-
- public string RunspaceName { get; set; }
-
- public string CustomPipeName { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/Breakpoint.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/Breakpoint.cs
deleted file mode 100644
index 0eeb00d8f..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/Breakpoint.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Utility;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class Breakpoint
- {
- public int? Id { get; set; }
-
- ///
- /// Gets an boolean indicator that if true, breakpoint could be set
- /// (but not necessarily at the desired location).
- ///
- public bool Verified { get; set; }
-
- ///
- /// Gets an optional message about the state of the breakpoint. This is shown to the user
- /// and can be used to explain why a breakpoint could not be verified.
- ///
- public string Message { get; set; }
-
- public Source Source { get; set; }
-
- public int? Line { get; set; }
-
- public int? Column { get; set; }
-
- private Breakpoint()
- {
- }
-
- public static Breakpoint Create(
- BreakpointDetails breakpointDetails)
- {
- Validate.IsNotNull(nameof(breakpointDetails), breakpointDetails);
-
- return new Breakpoint
- {
- Id = breakpointDetails.Id,
- Verified = breakpointDetails.Verified,
- Message = breakpointDetails.Message,
- Source = new Source { Path = breakpointDetails.Source },
- Line = breakpointDetails.LineNumber,
- Column = breakpointDetails.ColumnNumber
- };
- }
-
- public static Breakpoint Create(
- CommandBreakpointDetails breakpointDetails)
- {
- Validate.IsNotNull(nameof(breakpointDetails), breakpointDetails);
-
- return new Breakpoint {
- Verified = breakpointDetails.Verified,
- Message = breakpointDetails.Message
- };
- }
-
- public static Breakpoint Create(
- SourceBreakpoint sourceBreakpoint,
- string source,
- string message,
- bool verified = false)
- {
- Validate.IsNotNull(nameof(sourceBreakpoint), sourceBreakpoint);
- Validate.IsNotNull(nameof(source), source);
- Validate.IsNotNull(nameof(message), message);
-
- return new Breakpoint {
- Verified = verified,
- Message = message,
- Source = new Source { Path = source },
- Line = sourceBreakpoint.Line,
- Column = sourceBreakpoint.Column
- };
- }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/BreakpointEvent.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/BreakpointEvent.cs
deleted file mode 100644
index a339a70d9..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/BreakpointEvent.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class BreakpointEvent
- {
- public static readonly
- NotificationType Type =
- NotificationType.Create("breakpoint");
-
- public string Reason { get; set; }
-
- public Breakpoint Breakpoint { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/ConfigurationDoneRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/ConfigurationDoneRequest.cs
deleted file mode 100644
index 11cbc4ded..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/ConfigurationDoneRequest.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class ConfigurationDoneRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("configurationDone");
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/ContinueRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/ContinueRequest.cs
deleted file mode 100644
index 3f9dbc59c..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/ContinueRequest.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class ContinueRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("continue");
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/ContinuedEvent.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/ContinuedEvent.cs
deleted file mode 100644
index af442750f..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/ContinuedEvent.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class ContinuedEvent
- {
- public static readonly
- NotificationType Type =
- NotificationType.Create("continued");
-
- public int ThreadId { get; set; }
-
- public bool AllThreadsContinued { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/DisconnectRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/DisconnectRequest.cs
deleted file mode 100644
index 2235206cd..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/DisconnectRequest.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class DisconnectRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("disconnect");
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/EvaluateRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/EvaluateRequest.cs
deleted file mode 100644
index d45e7d44a..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/EvaluateRequest.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class EvaluateRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("evaluate");
- }
-
- public class EvaluateRequestArguments
- {
- ///
- /// The expression to evaluate.
- ///
- public string Expression { get; set; }
-
- ///
- /// The context in which the evaluate request is run. Possible
- /// values are 'watch' if evaluate is run in a watch or 'repl'
- /// if run from the REPL console.
- ///
- public string Context { get; set; }
-
- ///
- /// Evaluate the expression in the context of this stack frame.
- /// If not specified, the top most frame is used.
- ///
- public int FrameId { get; set; }
- }
-
- public class EvaluateResponseBody
- {
- ///
- /// The evaluation result.
- ///
- public string Result { get; set; }
-
- ///
- /// If variablesReference is > 0, the evaluate result is
- /// structured and its children can be retrieved by passing
- /// variablesReference to the VariablesRequest
- ///
- public int VariablesReference { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/ExitedEvent.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/ExitedEvent.cs
deleted file mode 100644
index 9f1a0d6ce..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/ExitedEvent.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class ExitedEvent
- {
- public static readonly
- NotificationType Type =
- NotificationType.Create("exited");
- }
-
- public class ExitedEventBody
- {
- public int ExitCode { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/InitializeRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/InitializeRequest.cs
deleted file mode 100644
index 7904759d9..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/InitializeRequest.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class InitializeRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("initialize");
- }
-
- public class InitializeRequestArguments
- {
- public string AdapterId { get; set; }
-
- public bool LinesStartAt1 { get; set; }
-
- public bool ColumnsStartAt1 { get; set; }
-
- public string PathFormat { get; set; }
-
- public bool SourceMaps { get; set; }
-
- public string GeneratedCodeDirectory { get; set; }
- }
-
- public class InitializeResponseBody
- {
- ///
- /// Gets or sets a boolean value that determines whether the debug adapter
- /// supports the configurationDoneRequest.
- ///
- public bool SupportsConfigurationDoneRequest { get; set; }
-
- ///
- /// Gets or sets a boolean value that determines whether the debug adapter
- /// supports functionBreakpoints.
- ///
- public bool SupportsFunctionBreakpoints { get; set; }
-
- ///
- /// Gets or sets a boolean value that determines whether the debug adapter
- /// supports conditionalBreakpoints.
- ///
- public bool SupportsConditionalBreakpoints { get; set; }
-
- ///
- /// Gets or sets a boolean value that determines whether the debug adapter
- /// supports breakpoints that break execution after a specified number of hits.
- ///
- public bool SupportsHitConditionalBreakpoints { get; set; }
-
- ///
- /// Gets or sets a boolean value that determines whether the debug adapter
- /// supports a (side effect free) evaluate request for data hovers.
- ///
- public bool SupportsEvaluateForHovers { get; set; }
-
- ///
- /// Gets or sets a boolean value that determines whether the debug adapter
- /// supports allowing the user to set a variable from the Variables debug windows.
- ///
- public bool SupportsSetVariable { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/InitializedEvent.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/InitializedEvent.cs
deleted file mode 100644
index 7253b7b30..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/InitializedEvent.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class InitializedEvent
- {
- public static readonly
- NotificationType Type =
- NotificationType.Create("initialized");
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/LaunchRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/LaunchRequest.cs
deleted file mode 100644
index 1bf5c9ea1..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/LaunchRequest.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System;
-using System.Collections.Generic;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class LaunchRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("launch");
- }
-
- public class LaunchRequestArguments
- {
- ///
- /// Gets or sets the absolute path to the script to debug.
- ///
- public string Script { get; set; }
-
- ///
- /// Gets or sets a boolean value that indicates whether the script should be
- /// run with (false) or without (true) debugging support.
- ///
- public bool NoDebug { get; set; }
-
- ///
- /// Gets or sets a boolean value that determines whether to automatically stop
- /// target after launch. If not specified, target does not stop.
- ///
- public bool StopOnEntry { get; set; }
-
- ///
- /// Gets or sets optional arguments passed to the debuggee.
- ///
- public string[] Args { get; set; }
-
- ///
- /// Gets or sets the working directory of the launched debuggee (specified as an absolute path).
- /// If omitted the debuggee is lauched in its own directory.
- ///
- public string Cwd { get; set; }
-
- ///
- /// Gets or sets a boolean value that determines whether to create a temporary
- /// integrated console for the debug session. Default is false.
- ///
- public bool CreateTemporaryIntegratedConsole { get; set; }
-
- ///
- /// Gets or sets the absolute path to the runtime executable to be used.
- /// Default is the runtime executable on the PATH.
- ///
- public string RuntimeExecutable { get; set; }
-
- ///
- /// Gets or sets the optional arguments passed to the runtime executable.
- ///
- public string[] RuntimeArgs { get; set; }
-
- ///
- /// Gets or sets optional environment variables to pass to the debuggee. The string valued
- /// properties of the 'environmentVariables' are used as key/value pairs.
- ///
- public Dictionary Env { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/NextRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/NextRequest.cs
deleted file mode 100644
index 1a254b96f..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/NextRequest.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- // /** StepOver request; value of command field is "next".
- // he request starts the debuggee to run again for one step.
- // penDebug will respond with a StoppedEvent (event type 'step') after running the step.
- public class NextRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("next");
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/OutputEvent.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/OutputEvent.cs
deleted file mode 100644
index 0044855c4..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/OutputEvent.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class OutputEvent
- {
- public static readonly
- NotificationType Type =
- NotificationType.Create("output");
- }
-
- public class OutputEventBody
- {
- public string Category { get; set; }
-
- public string Output { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/PauseRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/PauseRequest.cs
deleted file mode 100644
index 6fa67c584..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/PauseRequest.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class PauseRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("pause");
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/Scope.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/Scope.cs
deleted file mode 100644
index 5413869f4..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/Scope.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class Scope
- {
- ///
- /// Gets or sets the name of the scope (as such 'Arguments', 'Locals')
- ///
- public string Name { get; set; }
-
- ///
- /// Gets or sets the variables of this scope can be retrieved by passing the
- /// value of variablesReference to the VariablesRequest.
- ///
- public int VariablesReference { get; set; }
-
- ///
- /// Gets or sets a boolean value indicating if number of variables in
- /// this scope is large or expensive to retrieve.
- ///
- public bool Expensive { get; set; }
-
- public static Scope Create(VariableScope scope)
- {
- return new Scope {
- Name = scope.Name,
- VariablesReference = scope.Id,
- // Temporary fix for #95 to get debug hover tips to work well at least for the local scope.
- Expensive = ((scope.Name != VariableContainerDetails.LocalScopeName) &&
- (scope.Name != VariableContainerDetails.AutoVariablesName))
- };
- }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/ScopesRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/ScopesRequest.cs
deleted file mode 100644
index 4905ffdfe..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/ScopesRequest.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System.Diagnostics;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class ScopesRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("scopes");
- }
-
- [DebuggerDisplay("FrameId = {FrameId}")]
- public class ScopesRequestArguments
- {
- public int FrameId { get; set; }
- }
-
- public class ScopesResponseBody
- {
- public Scope[] Scopes { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/SetBreakpointsRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/SetBreakpointsRequest.cs
deleted file mode 100644
index 82d41ac53..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/SetBreakpointsRequest.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- ///
- /// SetBreakpoints request; value of command field is "setBreakpoints".
- /// Sets multiple breakpoints for a single source and clears all previous breakpoints in that source.
- /// To clear all breakpoint for a source, specify an empty array.
- /// When a breakpoint is hit, a StoppedEvent (event type 'breakpoint') is generated.
- ///
- public class SetBreakpointsRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("setBreakpoints");
- }
-
- public class SetBreakpointsRequestArguments
- {
- public Source Source { get; set; }
-
- public SourceBreakpoint[] Breakpoints { get; set; }
- }
-
- public class SourceBreakpoint
- {
- public int Line { get; set; }
-
- public int? Column { get; set; }
-
- public string Condition { get; set; }
-
- public string HitCondition { get; set; }
- }
-
- public class SetBreakpointsResponseBody
- {
- public Breakpoint[] Breakpoints { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/SetExceptionBreakpointsRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/SetExceptionBreakpointsRequest.cs
deleted file mode 100644
index 6a7313324..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/SetExceptionBreakpointsRequest.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- ///
- /// SetExceptionBreakpoints request; value of command field is "setExceptionBreakpoints".
- /// Enable that the debuggee stops on exceptions with a StoppedEvent (event type 'exception').
- ///
- public class SetExceptionBreakpointsRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("setExceptionBreakpoints");
- }
-
- ///
- /// Arguments for "setExceptionBreakpoints" request.
- ///
- public class SetExceptionBreakpointsRequestArguments
- {
- ///
- /// Gets or sets the names of enabled exception breakpoints.
- ///
- public string[] Filters { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/SetFunctionBreakpointsRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/SetFunctionBreakpointsRequest.cs
deleted file mode 100644
index 6fb951553..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/SetFunctionBreakpointsRequest.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class SetFunctionBreakpointsRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("setFunctionBreakpoints");
- }
-
- public class SetFunctionBreakpointsRequestArguments
- {
- public FunctionBreakpoint[] Breakpoints { get; set; }
- }
-
- public class FunctionBreakpoint
- {
- ///
- /// Gets or sets the name of the function to break on when it is invoked.
- ///
- public string Name { get; set; }
-
- public string Condition { get; set; }
-
- public string HitCondition { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/SetVariableRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/SetVariableRequest.cs
deleted file mode 100644
index 47e41cb36..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/SetVariableRequest.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System.Diagnostics;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- ///
- /// SetVariable request; value of command field is "setVariable".
- /// Request is initiated when user uses the debugger Variables UI to change the value of a variable.
- ///
- public class SetVariableRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("setVariable");
- }
-
- [DebuggerDisplay("VariablesReference = {VariablesReference}")]
- public class SetVariableRequestArguments
- {
- public int VariablesReference { get; set; }
-
- public string Name { get; set; }
-
- public string Value { get; set; }
- }
-
- public class SetVariableResponseBody
- {
- public string Value { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/Source.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/Source.cs
deleted file mode 100644
index 29f21bdf9..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/Source.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class Source
- {
- public string Name { get; set; }
-
- public string Path { get; set; }
-
- public int? SourceReference { get; set; }
-
- ///
- /// Gets an optional hint for how to present the source in the UI. A value of 'deemphasize'
- /// can be used to indicate that the source is not available or that it is skipped on stepping.
- ///
- public string PresentationHint { get; set; }
- }
-
- ///
- /// An optional hint for how to present source in the UI.
- ///
- public enum SourcePresentationHint
- {
- ///
- /// Dispays the source normally.
- ///
- Normal,
-
- ///
- /// Display the source emphasized.
- ///
- Emphasize,
-
- ///
- /// Display the source deemphasized.
- ///
- Deemphasize
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/SourceRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/SourceRequest.cs
deleted file mode 100644
index 48a2b0a17..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/SourceRequest.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class SourceRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("source");
- }
-
- public class SourceRequestArguments
- {
- ///
- /// Gets or sets the reference to the source. This is the value received in Source.reference.
- ///
- public int SourceReference { get; set; }
- }
-
- public class SourceResponseBody
- {
- public string Content { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/StackFrame.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/StackFrame.cs
deleted file mode 100644
index 4c8d80d81..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/StackFrame.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class StackFrame
- {
- ///
- /// Gets or sets an identifier for the stack frame. It must be unique across all threads.
- /// This id can be used to retrieve the scopes of the frame with the 'scopesRequest' or
- /// to restart the execution of a stackframe. */
- ///
- public int Id { get; set; }
-
- ///
- /// Gets or sets the name of the stack frame, typically a method name
- ///
- public string Name { get; set; }
-
- ///
- /// Gets or sets the optional source of the frame.
- ///
- public Source Source { get; set; }
-
- ///
- /// Gets or sets line within the file of the frame. If source is null or doesn't exist,
- /// line is 0 and must be ignored.
- ///
- public int Line { get; set; }
-
- ///
- /// Gets or sets an optional end line of the range covered by the stack frame.
- ///
- public int? EndLine { get; set; }
-
- ///
- /// Gets or sets the column within the line. If source is null or doesn't exist,
- /// column is 0 and must be ignored.
- ///
- public int Column { get; set; }
-
- ///
- /// Gets or sets an optional end column of the range covered by the stack frame.
- ///
- public int? EndColumn { get; set; }
-
- ///
- /// Gets an optional hint for how to present this frame in the UI. A value of 'label'
- /// can be used to indicate that the frame is an artificial frame that is used as a
- /// visual label or separator. A value of 'subtle' can be used to change the appearance
- /// of a frame in a 'subtle' way.
- ///
- public string PresentationHint { get; private set; }
-
- public static StackFrame Create(
- StackFrameDetails stackFrame,
- int id)
- {
- var sourcePresentationHint =
- stackFrame.IsExternalCode ? SourcePresentationHint.Deemphasize : SourcePresentationHint.Normal;
-
- // When debugging an interactive session, the ScriptPath is which is not a valid source file.
- // We need to make sure the user can't open the file associated with this stack frame.
- // It will generate a VSCode error in this case.
- Source source = null;
- if (!stackFrame.ScriptPath.Contains("<"))
- {
- source = new Source
- {
- Path = stackFrame.ScriptPath,
- PresentationHint = sourcePresentationHint.ToString().ToLower()
- };
- }
-
- return new StackFrame
- {
- Id = id,
- Name = (source != null) ? stackFrame.FunctionName : "Interactive Session",
- Line = (source != null) ? stackFrame.StartLineNumber : 0,
- EndLine = stackFrame.EndLineNumber,
- Column = (source != null) ? stackFrame.StartColumnNumber : 0,
- EndColumn = stackFrame.EndColumnNumber,
- Source = source
- };
- }
- }
-
- ///
- /// An optional hint for how to present a stack frame in the UI.
- ///
- public enum StackFramePresentationHint
- {
- ///
- /// Dispays the stack frame as a normal stack frame.
- ///
- Normal,
-
- ///
- /// Used to label an entry in the call stack that doesn't actually correspond to a stack frame.
- /// This is typically used to label transitions to/from "external" code.
- ///
- Label,
-
- ///
- /// Displays the stack frame in a subtle way, typically used from loctaions outside of the current project or workspace.
- ///
- Subtle
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/StackTraceRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/StackTraceRequest.cs
deleted file mode 100644
index 56a88a950..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/StackTraceRequest.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System.Diagnostics;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class StackTraceRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("stackTrace");
- }
-
- [DebuggerDisplay("ThreadId = {ThreadId}, Levels = {Levels}")]
- public class StackTraceRequestArguments
- {
- ///
- /// Gets or sets the ThreadId of this stacktrace.
- ///
- public int ThreadId { get; set; }
-
- ///
- /// Gets or sets the index of the first frame to return. If omitted frames start at 0.
- ///
- public int? StartFrame { get; set; }
-
- ///
- /// Gets or sets the maximum number of frames to return. If levels is not specified or 0, all frames are returned.
- ///
- public int? Levels { get; set; }
-
- ///
- /// Gets or sets the format string that specifies details on how to format the stack frames.
- ///
- public string Format { get; set; }
- }
-
- public class StackTraceResponseBody
- {
- ///
- /// Gets the frames of the stackframe. If the array has length zero, there are no stackframes available.
- /// This means that there is no location information available.
- ///
- public StackFrame[] StackFrames { get; set; }
-
- ///
- /// Gets the total number of frames available.
- ///
- public int? TotalFrames { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/StartedEvent.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/StartedEvent.cs
deleted file mode 100644
index 5b32d4a84..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/StartedEvent.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class StartedEvent
- {
- public static readonly
- NotificationType Type =
- NotificationType.Create("started");
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/StepInRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/StepInRequest.cs
deleted file mode 100644
index ec825ebbd..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/StepInRequest.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class StepInRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("stepIn");
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/StepOutRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/StepOutRequest.cs
deleted file mode 100644
index be0a31807..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/StepOutRequest.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class StepOutRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("stepOut");
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/StoppedEvent.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/StoppedEvent.cs
deleted file mode 100644
index a3c2a7921..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/StoppedEvent.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class StoppedEvent
- {
- public static readonly
- NotificationType Type =
- NotificationType.Create("stopped");
- }
-
- public class StoppedEventBody
- {
- ///
- /// A value such as "step", "breakpoint", "exception", or "pause"
- ///
- public string Reason { get; set; }
-
- ///
- /// Gets or sets the current thread ID, if any.
- ///
- public int? ThreadId { get; set; }
-
- public Source Source { get; set; }
-
- ///
- /// Gets or sets additional information such as an error message.
- ///
- public string Text { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/TerminatedEvent.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/TerminatedEvent.cs
deleted file mode 100644
index 514d0bcae..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/TerminatedEvent.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class TerminatedEvent
- {
- public static readonly
- NotificationType Type =
- NotificationType.Create("terminated");
-
- public bool Restart { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/Thread.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/Thread.cs
deleted file mode 100644
index 35a8a139d..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/Thread.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class Thread
- {
- public int Id { get; set; }
-
- public string Name { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/ThreadsRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/ThreadsRequest.cs
deleted file mode 100644
index 24432d671..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/ThreadsRequest.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class ThreadsRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("threads");
- }
-
- public class ThreadsResponseBody
- {
- public Thread[] Threads { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/Variable.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/Variable.cs
deleted file mode 100644
index a335b0975..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/Variable.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class Variable
- {
- public string Name { get; set; }
-
- // /** The variable's value. For structured objects this can be a multi line text, e.g. for a function the body of a function. */
- public string Value { get; set; }
-
- ///
- /// Gets or sets the type of the variable's value. Typically shown in the UI when hovering over the value.
- ///
- public string Type { get; set; }
-
- ///
- /// Gets or sets the evaluatable name for the variable that will be evaluated by the debugger.
- ///
- public string EvaluateName { get; set; }
-
- // /** If variablesReference is > 0, the variable is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. */
- public int VariablesReference { get; set; }
-
- public static Variable Create(VariableDetailsBase variable)
- {
- return new Variable
- {
- Name = variable.Name,
- Value = variable.ValueString ?? string.Empty,
- Type = variable.Type,
- EvaluateName = variable.Name,
- VariablesReference =
- variable.IsExpandable ?
- variable.Id : 0
- };
- }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/VariablesRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/VariablesRequest.cs
deleted file mode 100644
index f387c500f..000000000
--- a/src/PowerShellEditorServices.Protocol/DebugAdapter/VariablesRequest.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System.Diagnostics;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
-{
- public class VariablesRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("variables");
- }
-
- [DebuggerDisplay("VariablesReference = {VariablesReference}")]
- public class VariablesRequestArguments
- {
- public int VariablesReference { get; set; }
- }
-
- public class VariablesResponseBody
- {
- public Variable[] Variables { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/ClientCapabilities.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/ClientCapabilities.cs
deleted file mode 100644
index f66982c43..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/ClientCapabilities.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- ///
- /// Defines a class that describes the capabilities of a language
- /// client. At this time no specific capabilities are listed for
- /// clients.
- ///
- public class ClientCapabilities
- {
- public WorkspaceClientCapabilities Workspace { get; set; }
- public TextDocumentClientCapabilities TextDocument { get; set; }
- public object Experimental { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/CodeAction.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/CodeAction.cs
deleted file mode 100644
index a382d8dcf..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/CodeAction.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using Newtonsoft.Json.Linq;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class CodeActionRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("textDocument/codeAction");
- }
-
- ///
- /// Parameters for CodeActionRequest.
- ///
- public class CodeActionParams
- {
- ///
- /// The document in which the command was invoked.
- ///
- public TextDocumentIdentifier TextDocument { get; set; }
-
- ///
- /// The range for which the command was invoked.
- ///
- public Range Range { get; set; }
-
- ///
- /// Context carrying additional information.
- ///
- public CodeActionContext Context { get; set; }
- }
-
- public class CodeActionContext
- {
- public Diagnostic[] Diagnostics { get; set; }
- }
-
- public class CodeActionCommand
- {
- public string Title { get; set; }
-
- public string Command { get; set; }
-
- public JArray Arguments { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/CodeLens.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/CodeLens.cs
deleted file mode 100644
index fd12f284d..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/CodeLens.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using Newtonsoft.Json.Linq;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- ///
- /// Code Lens options.
- ///
- public class CodeLensOptions
- {
- ///
- /// Code lens has a resolve provider as well.
- ///
- public bool ResolveProvider { get; set; }
- }
-
- public class CodeLens
- {
- public Range Range { get; set; }
-
- public ServerCommand Command { get; set; }
-
- public JToken Data { get; set; }
- }
-
- ///
- /// A code lens represents a command that should be shown along with
- /// source text, like the number of references, a way to run tests, etc.
- ///
- /// A code lens is _unresolved_ when no command is associated to it. For performance
- /// reasons the creation of a code lens and resolving should be done in two stages.
- ///
- public class CodeLensRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("textDocument/codeLens");
-
- ///
- /// The document to request code lens for.
- ///
- public TextDocumentIdentifier TextDocument { get; set; }
- }
-
- public class CodeLensResolveRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("codeLens/resolve");
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/CommentHelpRequest.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/CommentHelpRequest.cs
deleted file mode 100644
index d4406519f..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/CommentHelpRequest.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- class CommentHelpRequest
- {
- public static readonly RequestType Type
- = RequestType.Create("powerShell/getCommentHelp");
- }
-
- public class CommentHelpRequestResult
- {
- public string[] Content { get; set; }
- }
-
- public class CommentHelpRequestParams
- {
- public string DocumentUri { get; set; }
- public Position TriggerPosition { get; set; }
- public bool BlockComment { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/Completion.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/Completion.cs
deleted file mode 100644
index 2e0cbeeca..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/Completion.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System.Diagnostics;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class CompletionRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("textDocument/completion");
- }
-
- public class CompletionResolveRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("completionItem/resolve");
- }
-
- ///
- /// Completion registration options.
- ///
- public class CompletionRegistrationOptions : TextDocumentRegistrationOptions
- {
- // We duplicate the properties of completionOptions class here because
- // we cannot derive from two classes. One way to get around this situation
- // is to use define CompletionOptions as an interface instead of a class.
- public bool? ResolveProvider { get; set; }
-
- public string[] TriggerCharacters { get; set; }
- }
-
- public enum CompletionItemKind
- {
- Text = 1,
- Method = 2,
- Function = 3,
- Constructor = 4,
- Field = 5,
- Variable = 6,
- Class = 7,
- Interface = 8,
- Module = 9,
- Property = 10,
- Unit = 11,
- Value = 12,
- Enum = 13,
- Keyword = 14,
- Snippet = 15,
- Color = 16,
- File = 17,
- Reference = 18,
- Folder = 19
- }
-
- public enum InsertTextFormat
- {
- PlainText = 1,
- Snippet = 2,
- }
-
- [DebuggerDisplay("NewText = {NewText}, Range = {Range.Start.Line}:{Range.Start.Character} - {Range.End.Line}:{Range.End.Character}")]
- public class TextEdit
- {
- public Range Range { get; set; }
-
- public string NewText { get; set; }
- }
-
- [DebuggerDisplay("Kind = {Kind.ToString()}, Label = {Label}, Detail = {Detail}")]
- public class CompletionItem
- {
- public string Label { get; set; }
-
- public CompletionItemKind? Kind { get; set; }
-
- public string Detail { get; set; }
-
- ///
- /// Gets or sets the documentation string for the completion item.
- ///
- public string Documentation { get; set; }
-
- public string SortText { get; set; }
-
- public string FilterText { get; set; }
-
- public string InsertText { get; set; }
-
- public InsertTextFormat InsertTextFormat { get; set; } = InsertTextFormat.PlainText;
-
- public Range Range { get; set; }
-
- public string[] CommitCharacters { get; set; }
-
- public TextEdit TextEdit { get; set; }
-
- public TextEdit[] AdditionalTextEdits { get; set; }
-
- public CommandType Command { get; set; }
-
- ///
- /// Gets or sets a custom data field that allows the server to mark
- /// each completion item with an identifier that will help correlate
- /// the item to the previous completion request during a completion
- /// resolve request.
- ///
- public object Data { get; set; }
- }
-
- ///
- /// Represents a reference to a command. Provides a title which will be used to
- /// represent a command in the UI and, optionally, an array of arguments which
- /// will be passed to the command handler function when invoked.
- ///
- /// The name of the corresponding type in vscode-languageserver-node is Command
- /// but since .net does not allow a property name (Command) and its enclosing
- /// type name to be the same we change its name to CommandType.
- ///
- public class CommandType
- {
- ///
- /// Title of the command.
- ///
- ///
- public string Title { get; set; }
-
- ///
- /// The identifier of the actual command handler.
- ///
- public string Command { get; set; }
-
- ///
- /// Arguments that the command handler should be invoked with.
- ///
- public object[] Arguments { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/Configuration.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/Configuration.cs
deleted file mode 100644
index a4228ee19..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/Configuration.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class DidChangeConfigurationNotification
- {
- public static readonly
- NotificationType, object> Type =
- NotificationType, object>.Create("workspace/didChangeConfiguration");
- }
-
- public class DidChangeConfigurationParams
- {
- public TConfig Settings { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/Definition.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/Definition.cs
deleted file mode 100644
index cee9a7215..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/Definition.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class DefinitionRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("textDocument/definition");
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/Diagnostics.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/Diagnostics.cs
deleted file mode 100644
index e5e46d45f..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/Diagnostics.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class PublishDiagnosticsNotification
- {
- public static readonly
- NotificationType Type =
- NotificationType.Create("textDocument/publishDiagnostics");
-
- ///
- /// Gets or sets the URI for which diagnostic information is reported.
- ///
- public string Uri { get; set; }
-
- ///
- /// Gets or sets the array of diagnostic information items.
- ///
- public Diagnostic[] Diagnostics { get; set; }
- }
-
- public enum DiagnosticSeverity
- {
- ///
- /// Indicates that the diagnostic represents an error.
- ///
- Error = 1,
-
- ///
- /// Indicates that the diagnostic represents a warning.
- ///
- Warning = 2,
-
- ///
- /// Indicates that the diagnostic represents an informational message.
- ///
- Information = 3,
-
- ///
- /// Indicates that the diagnostic represents a hint.
- ///
- Hint = 4
- }
-
- public class Diagnostic
- {
- public Range Range { get; set; }
-
- ///
- /// Gets or sets the severity of the diagnostic. If omitted, the
- /// client should interpret the severity.
- ///
- public DiagnosticSeverity? Severity { get; set; }
-
- ///
- /// Gets or sets the diagnostic's code (optional).
- ///
- public string Code { get; set; }
-
- ///
- /// Gets or sets the diagnostic message.
- ///
- public string Message { get; set; }
-
- ///
- /// Gets or sets the source of the diagnostic message.
- ///
- public string Source { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/DocumentHighlight.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/DocumentHighlight.cs
deleted file mode 100644
index cf8196f18..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/DocumentHighlight.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public enum DocumentHighlightKind
- {
- Text = 1,
- Read = 2,
- Write = 3
- }
-
- public class DocumentHighlight
- {
- public Range Range { get; set; }
-
- public DocumentHighlightKind Kind { get; set; }
- }
-
- public class DocumentHighlightRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("textDocument/documentHighlight");
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/DynamicRegistrationCapability.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/DynamicRegistrationCapability.cs
deleted file mode 100644
index 64d2c35ce..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/DynamicRegistrationCapability.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- ///
- /// Class to represent if a capability supports dynamic registration.
- ///
- public class DynamicRegistrationCapability
- {
- ///
- /// Whether the capability supports dynamic registration.
- ///
- public bool? DynamicRegistration { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/EditorCommands.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/EditorCommands.cs
deleted file mode 100644
index a7c385bc6..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/EditorCommands.cs
+++ /dev/null
@@ -1,185 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class ExtensionCommandAddedNotification
- {
- public static readonly
- NotificationType Type =
- NotificationType.Create("powerShell/extensionCommandAdded");
-
- public string Name { get; set; }
-
- public string DisplayName { get; set; }
- }
-
- public class ExtensionCommandUpdatedNotification
- {
- public static readonly
- NotificationType Type =
- NotificationType.Create("powerShell/extensionCommandUpdated");
-
- public string Name { get; set; }
- }
-
- public class ExtensionCommandRemovedNotification
- {
- public static readonly
- NotificationType Type =
- NotificationType.Create("powerShell/extensionCommandRemoved");
-
- public string Name { get; set; }
- }
-
- public class ClientEditorContext
- {
- public string CurrentFileContent { get; set; }
-
- public string CurrentFileLanguage { get; set; }
-
- public string CurrentFilePath { get; set; }
-
- public Position CursorPosition { get; set; }
-
- public Range SelectionRange { get; set; }
-
- }
-
- public class InvokeExtensionCommandRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("powerShell/invokeExtensionCommand");
-
- public string Name { get; set; }
-
- public ClientEditorContext Context { get; set; }
- }
-
- public class GetEditorContextRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("editor/getEditorContext");
- }
-
- public enum EditorCommandResponse
- {
- Unsupported,
- OK
- }
-
- public class InsertTextRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("editor/insertText");
-
- public string FilePath { get; set; }
-
- public string InsertText { get; set; }
-
- public Range InsertRange { get; set; }
- }
-
- public class SetSelectionRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("editor/setSelection");
-
- public Range SelectionRange { get; set; }
- }
-
- public class SetCursorPositionRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("editor/setCursorPosition");
-
- public Position CursorPosition { get; set; }
- }
-
- public class NewFileRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("editor/newFile");
- }
-
- public class OpenFileRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("editor/openFile");
- }
-
- public class OpenFileDetails
- {
- public string FilePath { get; set; }
-
- public bool Preview { get; set; }
- }
-
- public class CloseFileRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("editor/closeFile");
- }
-
- public class SaveFileRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("editor/saveFile");
- }
-
- public class SaveFileDetails
- {
- public string FilePath { get; set; }
-
- public string NewPath { get; set; }
- }
-
- public class ShowInformationMessageRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("editor/showInformationMessage");
- }
-
- public class ShowWarningMessageRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("editor/showWarningMessage");
- }
-
- public class ShowErrorMessageRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("editor/showErrorMessage");
- }
-
- public class SetStatusBarMessageRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("editor/setStatusBarMessage");
- }
-
- public class StatusBarMessageDetails
- {
- public string Message { get; set; }
-
- public int? Timeout { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/ExecutionStatusChangedEvent.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/ExecutionStatusChangedEvent.cs
deleted file mode 100644
index 5ac6eac6d..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/ExecutionStatusChangedEvent.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- ///
- /// Defines an event type for PowerShell context execution status changes (e.g. execution has completed)
- ///
- public class ExecutionStatusChangedEvent
- {
- ///
- /// The notification type for execution status change events in the message protocol
- ///
- public static readonly
- NotificationType Type =
- NotificationType.Create("powerShell/executionStatusChanged");
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/ExpandAliasRequest.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/ExpandAliasRequest.cs
deleted file mode 100644
index d5c2a9bc9..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/ExpandAliasRequest.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class ExpandAliasRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("powerShell/expandAlias");
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/FindModuleRequest.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/FindModuleRequest.cs
deleted file mode 100644
index fe14fdb65..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/FindModuleRequest.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using System.Collections.Generic;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class FindModuleRequest
- {
- public static readonly
- RequestType, object, object, object> Type =
- RequestType, object, object, object>.Create("powerShell/findModule");
- }
-
-
- public class PSModuleMessage
- {
- public string Name { get; set; }
- public string Description { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/Folding.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/Folding.cs
deleted file mode 100644
index f7b1d8f01..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/Folding.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class FoldingRangeRequest
- {
- ///
- /// A request to provide folding ranges in a document. The request's
- /// parameter is of type [FoldingRangeParams](#FoldingRangeParams), the
- /// response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable
- /// that resolves to such.
- /// Ref: https://github.com/Microsoft/vscode-languageserver-node/blob/5350bc2ffe8afb17357c1a66fbdd3845fa05adfd/protocol/src/protocol.foldingRange.ts#L112-L120
- ///
- public static readonly
- RequestType Type =
- RequestType.Create("textDocument/foldingRange");
- }
-
- ///
- /// Parameters for a [FoldingRangeRequest](#FoldingRangeRequest).
- /// Ref: https://github.com/Microsoft/vscode-languageserver-node/blob/5350bc2ffe8afb17357c1a66fbdd3845fa05adfd/protocol/src/protocol.foldingRange.ts#L102-L110
- ///
- public class FoldingRangeParams
- {
- ///
- /// The text document
- ///
- public TextDocumentIdentifier TextDocument { get; set; }
- }
-
- ///
- /// Represents a folding range.
- /// Ref: https://github.com/Microsoft/vscode-languageserver-node/blob/5350bc2ffe8afb17357c1a66fbdd3845fa05adfd/protocol/src/protocol.foldingRange.ts#L69-L100
- ///
- public class FoldingRange
- {
- ///
- /// The zero-based line number from where the folded range starts.
- ///
- public int StartLine { get; set; }
-
- ///
- /// The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
- ///
- public int StartCharacter { get; set; }
-
- ///
- /// The zero-based line number where the folded range ends.
- ///
- public int EndLine { get; set; }
-
- ///
- /// The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.
- ///
- public int EndCharacter { get; set; }
-
- ///
- /// Describes the kind of the folding range such as `comment' or 'region'. The kind
- /// is used to categorize folding ranges and used by commands like 'Fold all comments'. See
- /// [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds.
- ///
- public string Kind { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/Formatting.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/Formatting.cs
deleted file mode 100644
index f063ba163..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/Formatting.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class DocumentFormattingRequest
- {
- public static readonly RequestType Type = RequestType.Create("textDocument/formatting");
- }
-
- public class DocumentRangeFormattingRequest
- {
- public static readonly RequestType Type = RequestType.Create("textDocument/rangeFormatting");
-
- }
-
- public class DocumentOnTypeFormattingRequest
- {
- public static readonly RequestType Type = RequestType.Create("textDocument/onTypeFormatting");
-
- }
-
- public class DocumentRangeFormattingParams
- {
- ///
- /// The document to format.
- ///
- public TextDocumentIdentifier TextDocument { get; set; }
-
- ///
- /// The range to format.
- ///
- ///
- public Range Range { get; set; }
-
- ///
- /// The format options.
- ///
- public FormattingOptions Options { get; set; }
- }
-
- public class DocumentOnTypeFormattingParams
- {
- ///
- /// The document to format.
- ///
- public TextDocumentIdentifier TextDocument { get; set; }
-
- ///
- /// The position at which this request was sent.
- ///
- public Position Position { get; set; }
-
- ///
- /// The character that has been typed.
- ///
- public string ch { get; set; }
-
- ///
- /// The format options.
- ///
- public FormattingOptions options { get; set; }
- }
-
- public class DocumentFormattingParams
- {
- ///
- /// The document to format.
- ///
- public TextDocumentIdentifier TextDocument { get; set; }
-
- ///
- /// The format options.
- ///
- public FormattingOptions options { get; set; }
- }
-
- public class FormattingOptions
- {
- ///
- /// Size of a tab in spaces.
- ///
- public int TabSize { get; set; }
-
- ///
- /// Prefer spaces over tabs.
- ///
- public bool InsertSpaces { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/GetCommandRequest.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/GetCommandRequest.cs
deleted file mode 100644
index df847dcbe..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/GetCommandRequest.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using System.Collections.Generic;
-using System.Management.Automation;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- ///
- /// Describes the request to get the details for PowerShell Commands from the current session.
- ///
- public class GetCommandRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("powerShell/getCommand");
- }
-
- ///
- /// Describes the message to get the details for a single PowerShell Command
- /// from the current session
- ///
- public class PSCommandMessage
- {
- public string Name { get; set; }
- public string ModuleName { get; set; }
- public string DefaultParameterSet { get; set; }
- public Dictionary Parameters { get; set; }
- public System.Collections.ObjectModel.ReadOnlyCollection ParameterSets { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/GetPSHostProcessesRequest.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/GetPSHostProcessesRequest.cs
deleted file mode 100644
index 3c33a61d3..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/GetPSHostProcessesRequest.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class GetPSHostProcessesRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("powerShell/getPSHostProcesses");
- }
-
- public class GetPSHostProcessesResponse
- {
- public string ProcessName { get; set; }
-
- public int ProcessId { get; set; }
-
- public string AppDomainName { get; set; }
-
- public string MainWindowTitle { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/GetPSSARulesRequest.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/GetPSSARulesRequest.cs
deleted file mode 100644
index 2199558c5..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/GetPSSARulesRequest.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- class GetPSSARulesRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("powerShell/getPSSARules");
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/GetRunspaceRequest.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/GetRunspaceRequest.cs
deleted file mode 100644
index e151aa7f0..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/GetRunspaceRequest.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class GetRunspaceRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("powerShell/getRunspace");
- }
-
- public class GetRunspaceResponse
- {
- public int Id { get; set; }
-
- public string Name { get; set; }
-
- public string Availability { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/Hover.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/Hover.cs
deleted file mode 100644
index 42c853254..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/Hover.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class MarkedString
- {
- public string Language { get; set; }
-
- public string Value { get; set; }
- }
-
- public class Hover
- {
- public MarkedString[] Contents { get; set; }
-
- public Range Range { get; set; }
- }
-
- public class HoverRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("textDocument/hover");
-
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/Initialize.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/Initialize.cs
deleted file mode 100644
index 234b02169..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/Initialize.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class InitializeRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("initialize");
- }
-
- public enum TraceType {
- Off,
- Messages,
- Verbose
- }
-
- public class InitializeParams {
- ///
- /// The process Id of the parent process that started the server
- ///
- public int ProcessId { get; set; }
-
- ///
- /// The root path of the workspace. It is null if no folder is open.
- ///
- /// This property has been deprecated in favor of RootUri.
- ///
- public string RootPath { get; set; }
-
- ///
- /// The root uri of the workspace. It is null if not folder is open. If both
- /// `RootUri` and `RootPath` are non-null, `RootUri` should be used.
- ///
- public string RootUri { get; set; }
-
- ///
- /// The capabilities provided by the client.
- ///
- public ClientCapabilities Capabilities { get; set; }
-
- ///
- /// User provided initialization options.
- ///
- /// This is defined as `any` type on the client side.
- ///
- public object InitializationOptions { get; set; }
-
- // TODO We need to verify if the deserializer will map the type defined in the client
- // to an enum.
- ///
- /// The initial trace setting. If omitted trace is disabled.
- ///
- public TraceType Trace { get; set; } = TraceType.Off;
- }
-
- public class InitializeResult
- {
- ///
- /// Gets or sets the capabilities provided by the language server.
- ///
- public ServerCapabilities Capabilities { get; set; }
- }
-
- public class InitializeError
- {
- ///
- /// Gets or sets a boolean indicating whether the client should retry
- /// sending the Initialize request after showing the error to the user.
- ///
- public bool Retry { get; set;}
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/InitializedNotification.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/InitializedNotification.cs
deleted file mode 100644
index 90836017f..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/InitializedNotification.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- ///
- /// The initialized notification is sent from the client to the server after the client received the result
- /// of the initialize request but before the client is sending any other request or notification to the server.
- /// The server can use the initialized notification for example to dynamically register capabilities.
- /// The initialized notification may only be sent once.
- ///
- public class InitializedNotification
- {
- public static readonly
- NotificationType Type =
- NotificationType.Create("initialized");
- }
-
- ///
- /// Currently, the initialized message has no parameters.
- ///
- public class InitializedParams
- {
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/InstallModuleRequest.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/InstallModuleRequest.cs
deleted file mode 100644
index 096d0e461..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/InstallModuleRequest.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- class InstallModuleRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("powerShell/installModule");
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/PowerShellVersionRequest.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/PowerShellVersionRequest.cs
deleted file mode 100644
index 8f16b0abb..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/PowerShellVersionRequest.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using Microsoft.PowerShell.EditorServices.Session;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class PowerShellVersionRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("powerShell/getVersion");
- }
-
- public class PowerShellVersion
- {
- public string Version { get; set; }
-
- public string DisplayVersion { get; set; }
-
- public string Edition { get; set; }
-
- public string Architecture { get; set; }
-
- public PowerShellVersion()
- {
- }
-
- public PowerShellVersion(PowerShellVersionDetails versionDetails)
- {
- this.Version = versionDetails.VersionString;
- this.DisplayVersion = $"{versionDetails.Version.Major}.{versionDetails.Version.Minor}";
- this.Edition = versionDetails.Edition;
-
- switch (versionDetails.Architecture)
- {
- case PowerShellProcessArchitecture.X64:
- this.Architecture = "x64";
- break;
- case PowerShellProcessArchitecture.X86:
- this.Architecture = "x86";
- break;
- default:
- this.Architecture = "Architecture Unknown";
- break;
- }
- }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/ProjectTemplate.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/ProjectTemplate.cs
deleted file mode 100644
index 1b7441b28..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/ProjectTemplate.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-using Microsoft.PowerShell.EditorServices.Templates;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class NewProjectFromTemplateRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("powerShell/newProjectFromTemplate");
-
- public string DestinationPath { get; set; }
-
- public string TemplatePath { get; set; }
- }
-
- public class NewProjectFromTemplateResponse
- {
- public bool CreationSuccessful { get; set; }
- }
-
- public class GetProjectTemplatesRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("powerShell/getProjectTemplates");
-
- public bool IncludeInstalledModules { get; set; }
- }
-
- public class GetProjectTemplatesResponse
- {
- public bool NeedsModuleInstall { get; set; }
-
- public TemplateDetails[] Templates { get; set; }
- }
-}
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/References.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/References.cs
deleted file mode 100644
index 6965cb073..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/References.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class ReferencesRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("textDocument/references");
- }
-
- public class ReferencesParams : TextDocumentPositionParams
- {
- public ReferencesContext Context { get; set; }
- }
-
- public class ReferencesContext
- {
- public bool IncludeDeclaration { get; set; }
- }
-}
-
diff --git a/src/PowerShellEditorServices.Protocol/LanguageServer/RunspaceChanged.cs b/src/PowerShellEditorServices.Protocol/LanguageServer/RunspaceChanged.cs
deleted file mode 100644
index 3f2448097..000000000
--- a/src/PowerShellEditorServices.Protocol/LanguageServer/RunspaceChanged.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using Microsoft.PowerShell.EditorServices.Session;
-using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
-
-namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
-{
- public class RunspaceChangedEvent
- {
- public static readonly
- NotificationType