Skip to content
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
17 changes: 2 additions & 15 deletions PowerShellEditorServices.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function Invoke-WithCreateDefaultHook {
}
}

task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestE2E {
task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestE2E {

$dotnetPath = "$PSScriptRoot/.dotnet"
$dotnetExePath = if ($script:IsUnix) { "$dotnetPath/dotnet" } else { "$dotnetPath/dotnet.exe" }
Expand Down Expand Up @@ -241,8 +241,7 @@ function DotNetTestFilter {
if ($TestFilter) { @("--filter",$TestFilter) } else { "" }
}

# task Test TestServer,TestProtocol,TestE2E
task Test TestE2E
task Test TestServer,TestE2E

task TestServer {
Set-Location .\test\PowerShellEditorServices.Test\
Expand All @@ -256,18 +255,6 @@ task TestServer {
}
}

task TestProtocol {
Set-Location .\test\PowerShellEditorServices.Test.Protocol\

if (-not $script:IsUnix) {
exec { & $script:dotnetExe test --logger trx -f $script:NetRuntime.Desktop (DotNetTestFilter) }
}

Invoke-WithCreateDefaultHook {
exec { & $script:dotnetExe test --logger trx -f $script:NetRuntime.Core (DotNetTestFilter) }
}
}

task TestHost {
Set-Location .\test\PowerShellEditorServices.Test.Host\

Expand Down
21 changes: 0 additions & 21 deletions PowerShellEditorServices.sln
Original file line number Diff line number Diff line change
Expand Up @@ -18,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.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}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices", "src\PowerShellEditorServices\PowerShellEditorServices.csproj", "{29EEDF03-0990-45F4-846E-2616970D1FA2}"
Expand Down Expand Up @@ -95,24 +93,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
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.CoreCLR|Any CPU.ActiveCfg = Release|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.CoreCLR|Any CPU.Build.0 = Release|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.CoreCLR|x64.ActiveCfg = Release|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.CoreCLR|x64.Build.0 = Release|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.CoreCLR|x86.ActiveCfg = Release|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.CoreCLR|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
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.Debug|x64.Build.0 = Debug|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.Debug|x86.ActiveCfg = Debug|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.Debug|x86.Build.0 = Debug|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.Release|Any CPU.Build.0 = Release|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.Release|x64.ActiveCfg = Release|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.Release|x64.Build.0 = Release|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.Release|x86.ActiveCfg = Release|Any CPU
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4}.Release|x86.Build.0 = Release|Any CPU
{3B38E8DA-8BFF-4264-AF16-47929E6398A3}.CoreCLR|Any CPU.ActiveCfg = CoreCLR|Any CPU
{3B38E8DA-8BFF-4264-AF16-47929E6398A3}.CoreCLR|Any CPU.Build.0 = CoreCLR|Any CPU
{3B38E8DA-8BFF-4264-AF16-47929E6398A3}.CoreCLR|x64.ActiveCfg = CoreCLR|Any CPU
Expand Down Expand Up @@ -193,7 +173,6 @@ Global
{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}
{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}
{2561F253-8F72-436A-BCC3-AA63AB82EDC0} = {422E561A-8118-4BE7-A54F-9309E4F03AAE}
Expand Down
6 changes: 6 additions & 0 deletions src/PowerShellEditorServices/PowerShellEditorServices.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Microsoft.PowerShell.EditorServices.Hosting</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Microsoft.PowerShell.EditorServices.Test</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Microsoft.PowerShell.EditorServices.Test.Shared</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public Task<int> PromptForChoiceAsync(
throw new TaskCanceledException(task);
}

return this.GetSingleResult(task.Result);
return this.GetSingleResult(task.GetAwaiter().GetResult());
}));
}

Expand Down Expand Up @@ -205,7 +205,7 @@ private async Task<T> WaitForTaskAsync<T>(Task<T> taskToWait)
throw new PipelineStoppedException();
}

return taskToWait.Result;
return await taskToWait.ConfigureAwait(false);
}

private async Task<int[]> StartPromptLoopAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,13 @@ public void Initialize(
/// the runspace. This method will be moved somewhere else soon.
/// </summary>
/// <returns></returns>
public Task ImportCommandsModuleAsync()
public Task ImportCommandsModuleAsync() => ImportCommandsModuleAsync(s_commandsModulePath);

public Task ImportCommandsModuleAsync(string path)
{
PSCommand importCommand = new PSCommand()
.AddCommand("Import-Module")
.AddArgument(s_commandsModulePath);
.AddArgument(path);

return this.ExecuteCommandAsync<PSObject>(importCommand, sendOutputToHost: false, sendErrorToHost: false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Microsoft.PowerShell.EditorServices.Services.TextDocument
/// <summary>
/// A class that holds the information for a foldable region of text in a document
/// </summary>
public class FoldingReference: IComparable<FoldingReference>
public class FoldingReference: IComparable<FoldingReference>, IEquatable<FoldingReference>
{
/// <summary>
/// The zero-based line number from where the folded range starts.
Expand Down Expand Up @@ -59,8 +59,26 @@ public int CompareTo(FoldingReference that) {
if (this.EndCharacter > that.EndCharacter) { return 1; }

// They're the same range, but what about kind
return that.Kind.Value - this.Kind.Value;
if (this.Kind == null)
{
if (that.Kind == null)
{
return 0;
}
// that has a kind but this doesn't.
return 1;
}

if (that.Kind != null)
{
return that.Kind.Value - this.Kind.Value;
}

// this has a kind but that doesn't.
return -1;
}

public bool Equals(FoldingReference other) => this.CompareTo(other) == 0;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\PowerShellEditorServices\PowerShellEditorServices.csproj" />
<ProjectReference Include="..\..\src\PowerShellEditorServices.Protocol\PowerShellEditorServices.Protocol.csproj" />
<ProjectReference Include="..\..\src\PowerShellEditorServices.Host\PowerShellEditorServices.Host.csproj" />
<ProjectReference Include="..\PowerShellEditorServices.Test.Shared\PowerShellEditorServices.Test.Shared.csproj" />
</ItemGroup>
Expand Down
9 changes: 0 additions & 9 deletions test/PowerShellEditorServices.Test.Protocol/App.config

This file was deleted.

This file was deleted.

Loading