Skip to content

DO NOT MERGE Rebase attempt #821

New issue

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

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

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ registered_data.ini
.dotnet/
module/Plaster
module/PSScriptAnalyzer
module/PSReadLine
docs/_site/
docs/_repo/
docs/metadata/
Expand Down
13 changes: 7 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ language: cpp
git:
depth: 1000

os:
- linux
- osx
sudo: required
dist: trusty
osx_image: xcode8.3
matrix:
include:
- os: linux
dist: trusty
sudo: required
- os: osx
osx_image: xcode9.4

before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
Expand Down
8 changes: 1 addition & 7 deletions NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,4 @@
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<clear />
<add key="CI Builds (dotnet-core)" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="powershell-core" value="https://powershell.myget.org/F/powershell-core/api/v3/index.json" />
</packageSources>
</configuration>
</configuration>
3 changes: 1 addition & 2 deletions PowerShellEditorServices.Common.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>1.10.2</VersionPrefix>
<VersionPrefix>2.0.0</VersionPrefix>
<Company>Microsoft</Company>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageTags>PowerShell;editor;development;language;debugging</PackageTags>
Expand All @@ -9,6 +9,5 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/PowerShell/PowerShellEditorServices</RepositoryUrl>
<DebugType>portable</DebugType>
<RuntimeFrameworkVersion>1.0.3</RuntimeFrameworkVersion>
</PropertyGroup>
</Project>
294 changes: 217 additions & 77 deletions PowerShellEditorServices.build.ps1

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
version: '1.10.2{build}'
version: '2.0.0{build}'
image: Visual Studio 2017
clone_depth: 10
skip_tags: true

branches:
only:
- master
- 2.0.0
- rebase-attempt

environment:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Don't download unneeded packages
DOTNET_CLI_TELEMETRY_OPTOUT: true # Don't send telemetry

install:
- ps: |
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | Out-Null
Get-Module PowerShellGet,PackageManagement | Remove-Module -Force -Verbose
powershell -Command { Install-Module -Name PowershellGet -MinimumVersion 1.6 -force -confirm:$false -verbose }
powershell -Command { Install-Module -Name PackageManagement -MinimumVersion 1.1.7.0 -Force -Confirm:$false -Verbose }
Import-Module -Name PowerShellGet -MinimumVersion 1.6 -Force
Import-Module -Name PackageManagement -MinimumVersion 1.1.7.0 -Force
Install-PackageProvider -Name NuGet -Force | Out-Null
Import-PackageProvider NuGet -Force | Out-Null
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted | Out-Null
Install-Module InvokeBuild -MaximumVersion 5.1.0 -Scope CurrentUser -Force | Out-Null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#

if (!$PSVersionTable.PSEdition -or $PSVersionTable.PSEdition -eq "Desktop") {
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/Microsoft.PowerShell.EditorServices.VSCode.dll"
}
else {
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Core/Microsoft.PowerShell.EditorServices.VSCode.dll"
}
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.VSCode.dll"

if ($psEditor -is [Microsoft.PowerShell.EditorServices.Extensions.EditorObject]) {
[Microsoft.PowerShell.EditorServices.VSCode.ComponentRegistration]::Register($psEditor.Components)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PowerShellEditorServices.psm1'

# Version number of this module.
ModuleVersion = '1.10.2'
ModuleVersion = '2.0.0'

# ID used to uniquely identify this module
GUID = '9ca15887-53a2-479a-9cda-48d26bcb6c47'
Expand Down
21 changes: 13 additions & 8 deletions module/PowerShellEditorServices/PowerShellEditorServices.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#

if (!$PSVersionTable.PSEdition -or $PSVersionTable.PSEdition -eq "Desktop") {
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/Microsoft.PowerShell.EditorServices.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/Microsoft.PowerShell.EditorServices.Host.dll"
}
else {
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Core/Microsoft.PowerShell.EditorServices.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Core/Microsoft.PowerShell.EditorServices.Protocol.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Core/Microsoft.PowerShell.EditorServices.Host.dll"
# Need to load pipe handling shim assemblies in Windows PowerShell and PSCore 6.0 because they don't have WCP
if ($PSEdition -eq 'Desktop') {
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/System.IO.Pipes.AccessControl.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/System.Security.AccessControl.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/System.Security.Principal.Windows.dll"
} elseif ($PSVersionTable.PSVersion -ge '6.0' -and $PSVersionTable.PSVersion -lt '6.1' -and $IsWindows) {
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/6.0/System.IO.Pipes.AccessControl.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/6.0/System.Security.AccessControl.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/6.0/System.Security.Principal.Windows.dll"
}

Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.Host.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.Protocol.dll"

function Start-EditorServicesHost {
[CmdletBinding()]
param(
Expand Down
92 changes: 36 additions & 56 deletions module/PowerShellEditorServices/Start-EditorServices.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -353,74 +353,54 @@ try {

# Create the Editor Services host
Log "Invoking Start-EditorServicesHost"

$splat = @{
HostName = $HostName
HostProfileId = $HostProfileId
HostVersion = $HostVersion
LogPath = $LogPath
LogLevel = $LogLevel
AdditionalModules = $AdditionalModules
BundledModulesPath = $BundledModulesPath
EnableConsoleRepl = $EnableConsoleRepl.IsPresent
DebugServiceOnly = $DebugServiceOnly.IsPresent
WaitForDebugger = $WaitForDebugger.IsPresent
FeatureFlags = $FeatureFlags
}

# There could be only one service on Stdio channel
# Locate available port numbers for services
switch ($PSCmdlet.ParameterSetName) {
"Stdio" {
$editorServicesHost = Start-EditorServicesHost `
-HostName $HostName `
-HostProfileId $HostProfileId `
-HostVersion $HostVersion `
-LogPath $LogPath `
-LogLevel $LogLevel `
-AdditionalModules $AdditionalModules `
-Stdio `
-BundledModulesPath $BundledModulesPath `
-EnableConsoleRepl:$EnableConsoleRepl.IsPresent `
-DebugServiceOnly:$DebugServiceOnly.IsPresent `
-WaitForDebugger:$WaitForDebugger.IsPresent
$splat.Stdio = $true
$editorServicesHost = Start-EditorServicesHost @splat
break
}

"NamedPipeSimplex" {
$LanguageServiceInPipeName = Get-ValidatedNamedPipeName $LanguageServiceInPipeName
$LanguageServiceOutPipeName = Get-ValidatedNamedPipeName $LanguageServiceOutPipeName
$DebugServiceInPipeName = Get-ValidatedNamedPipeName $DebugServiceInPipeName
$DebugServiceOutPipeName = Get-ValidatedNamedPipeName $DebugServiceOutPipeName

$editorServicesHost = Start-EditorServicesHost `
-HostName $HostName `
-HostProfileId $HostProfileId `
-HostVersion $HostVersion `
-LogPath $LogPath `
-LogLevel $LogLevel `
-AdditionalModules $AdditionalModules `
-LanguageServiceInNamedPipe $LanguageServiceInPipeName `
-LanguageServiceOutNamedPipe $LanguageServiceOutPipeName `
-DebugServiceInNamedPipe $DebugServiceInPipeName `
-DebugServiceOutNamedPipe $DebugServiceOutPipeName `
-BundledModulesPath $BundledModulesPath `
-EnableConsoleRepl:$EnableConsoleRepl.IsPresent `
-DebugServiceOnly:$DebugServiceOnly.IsPresent `
-WaitForDebugger:$WaitForDebugger.IsPresent

Set-PipeFileResult $resultDetails "languageServiceReadPipeName" $LanguageServiceInPipeName
Set-PipeFileResult $resultDetails "languageServiceWritePipeName" $LanguageServiceOutPipeName
Set-PipeFileResult $resultDetails "debugServiceReadPipeName" $DebugServiceInPipeName
Set-PipeFileResult $resultDetails "debugServiceWritePipeName" $DebugServiceOutPipeName
$splat.LanguageServiceInNamedPipe = Get-ValidatedNamedPipeName $LanguageServiceInPipeName
$splat.LanguageServiceOutNamedPipe = Get-ValidatedNamedPipeName $LanguageServiceOutPipeName
$splat.DebugServiceInNamedPipe = Get-ValidatedNamedPipeName $DebugServiceInPipeName
$splat.DebugServiceOutNamedPipe = Get-ValidatedNamedPipeName $DebugServiceOutPipeName

$editorServicesHost = Start-EditorServicesHost @splat

Set-PipeFileResult $resultDetails "languageServiceReadPipeName" $splat.LanguageServiceInNamedPipe
Set-PipeFileResult $resultDetails "languageServiceWritePipeName" $splat.LanguageServiceOutNamedPipe
Set-PipeFileResult $resultDetails "debugServiceReadPipeName" $splat.DebugServiceInNamedPipe
Set-PipeFileResult $resultDetails "debugServiceWritePipeName" $splat.DebugServiceOutNamedPipe
break
}

Default {
$LanguageServicePipeName = Get-ValidatedNamedPipeName $LanguageServicePipeName
$DebugServicePipeName = Get-ValidatedNamedPipeName $DebugServicePipeName

$editorServicesHost = Start-EditorServicesHost `
-HostName $HostName `
-HostProfileId $HostProfileId `
-HostVersion $HostVersion `
-LogPath $LogPath `
-LogLevel $LogLevel `
-AdditionalModules $AdditionalModules `
-LanguageServiceNamedPipe $LanguageServicePipeName `
-DebugServiceNamedPipe $DebugServicePipeName `
-BundledModulesPath $BundledModulesPath `
-EnableConsoleRepl:$EnableConsoleRepl.IsPresent `
-DebugServiceOnly:$DebugServiceOnly.IsPresent `
-WaitForDebugger:$WaitForDebugger.IsPresent

Set-PipeFileResult $resultDetails "languageServicePipeName" $LanguageServicePipeName
Set-PipeFileResult $resultDetails "debugServicePipeName" $DebugServicePipeName
$splat.LanguageServiceNamedPipe = Get-ValidatedNamedPipeName $LanguageServicePipeName
$splat.DebugServiceNamedPipe = Get-ValidatedNamedPipeName $DebugServicePipeName

$editorServicesHost = Start-EditorServicesHost @splat
Log ($splat | Out-String)
Log $LanguageServicePipeName
Set-PipeFileResult $resultDetails "languageServicePipeName" $splat.LanguageServiceNamedPipe
Set-PipeFileResult $resultDetails "debugServicePipeName" $splat.DebugServiceNamedPipe
break
}
}
Expand Down
5 changes: 5 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
"MinimumVersion":"1.0",
"MaximumVersion":"1.99",
"AllowPrerelease":false
},
"PSReadLine":{
"MinimumVersion":"2.0.0-beta3",
"MaximumVersion":"2.1",
"AllowPrerelease":true
}
}
2 changes: 1 addition & 1 deletion scripts/travis.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

$ErrorActionPreference = 'Stop'

# Install InvokeBuild
Install-Module InvokeBuild -MaximumVersion 5.1.0 -Scope CurrentUser -Force
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public WebsocketClientChannel(string url)
this.serverUrl = url;
}

public override async Task WaitForConnection()
public override async Task WaitForConnectionAsync()
{
try
{
Expand All @@ -52,7 +52,7 @@ public override async Task WaitForConnection()
{
Logger.Write(LogLevel.Warning,
string.Format("Failed to connect to WebSocket server. Error was '{0}'", wsException.Message));

}

throw;
Expand Down Expand Up @@ -99,7 +99,7 @@ protected override void Shutdown()
}

/// <summary>
/// Extension of <see cref="MemoryStream"/> that sends data to a WebSocket during FlushAsync
/// Extension of <see cref="MemoryStream"/> that sends data to a WebSocket during FlushAsync
/// and reads during WriteAsync.
/// </summary>
internal class ClientWebSocketStream : MemoryStream
Expand All @@ -110,7 +110,7 @@ internal class ClientWebSocketStream : MemoryStream
/// Constructor
/// </summary>
/// <remarks>
/// It is expected that the socket is in an Open state.
/// It is expected that the socket is in an Open state.
/// </remarks>
/// <param name="socket"></param>
public ClientWebSocketStream(ClientWebSocket socket)
Expand All @@ -119,7 +119,7 @@ public ClientWebSocketStream(ClientWebSocket socket)
}

/// <summary>
/// Reads from the WebSocket.
/// Reads from the WebSocket.
/// </summary>
/// <param name="buffer"></param>
/// <param name="offset"></param>
Expand All @@ -138,7 +138,7 @@ public override async Task<int> ReadAsync(byte[] buffer, int offset, int count,
{
result = await socket.ReceiveAsync(new ArraySegment<byte>(buffer, offset, count), cancellationToken);
} while (!result.EndOfMessage);

if (result.MessageType == WebSocketMessageType.Close)
{
await socket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Closing", cancellationToken);
Expand Down
Loading