Skip to content

[Ignore] Bring master forward to 2.0.0 #852

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

Merged
merged 5 commits into from
Jan 18, 2019
Merged
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.3</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>
306 changes: 214 additions & 92 deletions PowerShellEditorServices.build.ps1

Large diffs are not rendered by default.

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

branches:
only:
- master
- 2.0.0

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.3'
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
11 changes: 7 additions & 4 deletions module/PowerShellEditorServices/Start-EditorServices.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ try {
"status" = "not started";
"languageServiceTransport" = $PSCmdlet.ParameterSetName;
"debugServiceTransport" = $PSCmdlet.ParameterSetName;
};
}

# Create the Editor Services host
Log "Invoking Start-EditorServicesHost"
Expand All @@ -368,7 +368,8 @@ try {
-BundledModulesPath $BundledModulesPath `
-EnableConsoleRepl:$EnableConsoleRepl.IsPresent `
-DebugServiceOnly:$DebugServiceOnly.IsPresent `
-WaitForDebugger:$WaitForDebugger.IsPresent
-WaitForDebugger:$WaitForDebugger.IsPresent `
-FeatureFlags $FeatureFlags
break
}

Expand All @@ -392,7 +393,8 @@ try {
-BundledModulesPath $BundledModulesPath `
-EnableConsoleRepl:$EnableConsoleRepl.IsPresent `
-DebugServiceOnly:$DebugServiceOnly.IsPresent `
-WaitForDebugger:$WaitForDebugger.IsPresent
-WaitForDebugger:$WaitForDebugger.IsPresent `
-FeatureFlags $FeatureFlags

Set-PipeFileResult $resultDetails "languageServiceReadPipeName" $LanguageServiceInPipeName
Set-PipeFileResult $resultDetails "languageServiceWritePipeName" $LanguageServiceOutPipeName
Expand All @@ -417,7 +419,8 @@ try {
-BundledModulesPath $BundledModulesPath `
-EnableConsoleRepl:$EnableConsoleRepl.IsPresent `
-DebugServiceOnly:$DebugServiceOnly.IsPresent `
-WaitForDebugger:$WaitForDebugger.IsPresent
-WaitForDebugger:$WaitForDebugger.IsPresent `
-FeatureFlags $FeatureFlags

Set-PipeFileResult $resultDetails "languageServicePipeName" $LanguageServicePipeName
Set-PipeFileResult $resultDetails "debugServicePipeName" $DebugServicePipeName
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
namespace Microsoft.PowerShell.EditorServices.Channel.WebSocket
{
/// <summary>
/// Implementation of <see cref="ChannelBase"/> that implements the streams necessary for
/// communicating via OWIN WebSockets.
/// Implementation of <see cref="ChannelBase"/> that implements the streams necessary for
/// communicating via OWIN WebSockets.
/// </summary>
public class WebSocketServerChannel : ChannelBase
{
Expand All @@ -42,22 +42,22 @@ protected override void Initialize(IMessageSerializer messageSerializer)

this.MessageWriter =
new MessageWriter(
new WebSocketStream(socketConnection),
new WebSocketStream(socketConnection),
messageSerializer);
}

/// <summary>
/// Dispatches data received during calls to OnMessageReceived in the <see cref="WebSocketConnection"/> class.
/// Dispatches data received during calls to OnMessageReceivedAsync in the <see cref="WebSocketConnection"/> class.
/// </summary>
/// <remarks>
/// This method calls an overriden version of the <see cref="MessageDispatcher"/> that dispatches messages on
/// demand rather than running on a background thread.
/// This method calls an overriden version of the <see cref="MessageDispatcher"/> that dispatches messages on
/// demand rather than running on a background thread.
/// </remarks>
/// <param name="message"></param>
/// <returns></returns>
public async Task Dispatch(ArraySegment<byte> message)
public async Task DispatchAsync(ArraySegment<byte> message)
{
//Clear our stream
//Clear our stream
inStream.SetLength(0);

//Write data and dispatch to handlers
Expand All @@ -70,19 +70,19 @@ protected override void Shutdown()
this.socketConnection.Close(WebSocketCloseStatus.NormalClosure, "Server shutting down");
}

public override Task WaitForConnection()
public override Task WaitForConnectionAsync()
{
// TODO: Need to update behavior here
return Task.FromResult(true);
}
}

/// <summary>
/// Overriden <see cref="MemoryStream"/> that sends data through a <see cref="WebSocketConnection"/> during the FlushAsync call.
/// Overriden <see cref="MemoryStream"/> that sends data through a <see cref="WebSocketConnection"/> during the FlushAsync call.
/// </summary>
/// <remarks>
/// FlushAsync will send data via the SendBinary method of the <see cref="WebSocketConnection"/> class. The memory streams length will
/// then be set to 0 to reset the stream for additional data to be written.
/// then be set to 0 to reset the stream for additional data to be written.
/// </remarks>
internal class WebSocketStream : MemoryStream
{
Expand All @@ -106,7 +106,7 @@ public override async Task FlushAsync(CancellationToken cancellationToken)
/// </summary>
public abstract class EditorServiceWebSocketConnection : WebSocketConnection
{
protected EditorServiceWebSocketConnection()
protected EditorServiceWebSocketConnection()
{
Channel = new WebSocketServerChannel(this);
}
Expand All @@ -120,9 +120,9 @@ public override void OnOpen()
Server.Start();
}

public override async Task OnMessageReceived(ArraySegment<byte> message, WebSocketMessageType type)
public override async Task OnMessageReceivedAsync(ArraySegment<byte> message, WebSocketMessageType type)
{
await Channel.Dispatch(message);
await Channel.DispatchAsync(message);
}

public override Task OnCloseAsync(WebSocketCloseStatus? closeStatus, string closeStatusDescription)
Expand Down
14 changes: 7 additions & 7 deletions src/PowerShellEditorServices.Host/CodeLens/CodeLensFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public static CodeLensFeature Create(

messageHandlers.SetRequestHandler(
CodeLensRequest.Type,
codeLenses.HandleCodeLensRequest);
codeLenses.HandleCodeLensRequestAsync);

messageHandlers.SetRequestHandler(
CodeLensResolveRequest.Type,
codeLenses.HandleCodeLensResolveRequest);
codeLenses.HandleCodeLensResolveRequestAsync);

codeLenses.Providers.Add(
new ReferencesCodeLensProvider(
Expand Down Expand Up @@ -111,7 +111,7 @@ public CodeLens[] ProvideCodeLenses(ScriptFile scriptFile)
/// </summary>
/// <param name="codeLensParams">Parameters on the CodeLens request that was received.</param>
/// <param name="requestContext"></param>
private async Task HandleCodeLensRequest(
private async Task HandleCodeLensRequestAsync(
CodeLensRequest codeLensParams,
RequestContext<LanguageServer.CodeLens[]> requestContext)
{
Expand All @@ -132,15 +132,15 @@ private async Task HandleCodeLensRequest(
_jsonSerializer);
}

await requestContext.SendResult(codeLensResponse);
await requestContext.SendResultAsync(codeLensResponse);
}

/// <summary>
/// Handle a CodeLens resolve request from VSCode.
/// </summary>
/// <param name="codeLens">The CodeLens to be resolved/updated.</param>
/// <param name="requestContext"></param>
private async Task HandleCodeLensResolveRequest(
private async Task HandleCodeLensResolveRequestAsync(
LanguageServer.CodeLens codeLens,
RequestContext<LanguageServer.CodeLens> requestContext)
{
Expand Down Expand Up @@ -178,13 +178,13 @@ await originalProvider.ResolveCodeLensAsync(
originalCodeLens,
CancellationToken.None);

await requestContext.SendResult(
await requestContext.SendResultAsync(
resolvedCodeLens.ToProtocolCodeLens(
_jsonSerializer));
}
else
{
await requestContext.SendError(
await requestContext.SendErrorAsync(
$"Could not find provider for the original CodeLens: {codeLensData.ProviderId}");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public async Task<CodeLens> ResolveCodeLensAsync(
codeLens.ScriptExtent.StartLineNumber,
codeLens.ScriptExtent.StartColumnNumber);

FindReferencesResult referencesResult = await _editorSession.LanguageService.FindReferencesOfSymbol(
FindReferencesResult referencesResult = await _editorSession.LanguageService.FindReferencesOfSymbolAsync(
foundSymbol,
references,
_editorSession.Workspace);
Expand Down
Loading