diff --git a/PowerShellEditorServices.build.ps1 b/PowerShellEditorServices.build.ps1
index 2af0db8b9..136a0547b 100644
--- a/PowerShellEditorServices.build.ps1
+++ b/PowerShellEditorServices.build.ps1
@@ -5,27 +5,36 @@ param(
[ValidateSet("Debug", "Release")]
[string]$Configuration = "Debug",
+ [switch]$LocalOmniSharp,
+
[string]$PsesSubmodulePath = "$PSScriptRoot/module",
[string]$ModulesJsonPath = "$PSScriptRoot/modules.json",
[string]$DefaultModuleRepository = "PSGallery",
- [string[]]$VerbosityArgs = @("--verbosity", "quiet", "--nologo"),
+ [string]$Verbosity = "quiet",
# See: https://docs.microsoft.com/en-us/dotnet/core/testing/selective-unit-tests
[string]$TestFilter = '',
# See: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test
- [string[]]$TestArgs = $VerbosityArgs + @("--logger", "console;verbosity=normal", "--logger", "trx")
+ [string[]]$TestArgs = @("--logger", "console;verbosity=normal", "--logger", "trx")
)
#Requires -Modules @{ModuleName="InvokeBuild"; ModuleVersion="5.0.0"}
#Requires -Modules @{ModuleName="platyPS"; ModuleVersion="0.14.0"}
-$script:dotnetTestArgs = @(
- "test"
- $TestArgs
+$script:dotnetBuildArgs = @(
+ "--verbosity"
+ $Verbosity
+ "--nologo"
+ "-c"
+ $Configuration
+ if ($LocalOmniSharp) { "-property:LocalOmniSharp=true" }
+)
+
+$script:dotnetTestArgs = @("test") + $script:dotnetBuildArgs + $TestArgs + @(
if ($TestFilter) { "--filter", $TestFilter }
"--framework"
)
@@ -80,7 +89,7 @@ Task BinClean {
}
Task Clean FindDotNet, BinClean, {
- Invoke-BuildExec { & dotnet clean $VerbosityArgs }
+ Invoke-BuildExec { & dotnet clean --verbosity $Verbosity }
Get-ChildItem -Recurse $PSScriptRoot\src\*.nupkg | Remove-BuildItem
Get-ChildItem $PSScriptRoot\PowerShellEditorServices*.zip | Remove-BuildItem
Get-ChildItem $PSScriptRoot\module\PowerShellEditorServices\Commands\en-US\*-help.xml | Remove-BuildItem
@@ -162,15 +171,14 @@ Task SetupHelpForTests {
}
Task Build FindDotNet, CreateBuildInfo, {
- Invoke-BuildExec { & dotnet restore $VerbosityArgs }
- Invoke-BuildExec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f $script:NetRuntime.Standard }
- Invoke-BuildExec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.PS7 }
+ Invoke-BuildExec { & dotnet publish $script:dotnetBuildArgs .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f $script:NetRuntime.Standard }
+ Invoke-BuildExec { & dotnet publish $script:dotnetBuildArgs .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.PS7 }
if (-not $script:IsNix) {
- Invoke-BuildExec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.Desktop }
+ Invoke-BuildExec { & dotnet publish $script:dotnetBuildArgs .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.Desktop }
}
# Build PowerShellEditorServices.VSCode module
- Invoke-BuildExec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.VSCode\PowerShellEditorServices.VSCode.csproj -f $script:NetRuntime.Standard }
+ Invoke-BuildExec { & dotnet publish $script:dotnetBuildArgs .\src\PowerShellEditorServices.VSCode\PowerShellEditorServices.VSCode.csproj -f $script:NetRuntime.Standard }
}
Task Test TestServer, TestE2E
diff --git a/src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj b/src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj
index c5aa05dd4..2a172f2fc 100644
--- a/src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj
+++ b/src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj
@@ -21,7 +21,7 @@
-
+
diff --git a/src/PowerShellEditorServices/IsExternalInit.cs b/src/PowerShellEditorServices/IsExternalInit.cs
new file mode 100644
index 000000000..c2a9d8275
--- /dev/null
+++ b/src/PowerShellEditorServices/IsExternalInit.cs
@@ -0,0 +1,19 @@
+#pragma warning disable IDE0073
+#if NET5_0_OR_GREATER
+[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.IsExternalInit))]
+#else
+
+using System.ComponentModel;
+
+namespace System.Runtime.CompilerServices
+{
+ ///
+ /// Reserved to be used by the compiler for tracking metadata.
+ /// This class should not be used by developers in source code.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ internal static class IsExternalInit
+ {
+ }
+}
+#endif
diff --git a/src/PowerShellEditorServices/PowerShellEditorServices.csproj b/src/PowerShellEditorServices/PowerShellEditorServices.csproj
index 6d2b5e3d5..2e06e66e3 100644
--- a/src/PowerShellEditorServices/PowerShellEditorServices.csproj
+++ b/src/PowerShellEditorServices/PowerShellEditorServices.csproj
@@ -28,10 +28,8 @@
-
-
-
-
+
+
@@ -42,6 +40,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/PowerShellEditorServices/Utility/IsExternalInit.cs b/src/PowerShellEditorServices/Utility/IsExternalInit.cs
deleted file mode 100644
index 1f0f8f07c..000000000
--- a/src/PowerShellEditorServices/Utility/IsExternalInit.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using System.ComponentModel;
-
-namespace System.Runtime.CompilerServices
-{
- ///
- /// This type must be defined to use init property accessors,
- /// but is not in .NET Standard 2.0.
- /// So instead we define the type in our own code.
- ///
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal class IsExternalInit { }
-}
diff --git a/test/PowerShellEditorServices.Test.E2E/PowerShellEditorServices.Test.E2E.csproj b/test/PowerShellEditorServices.Test.E2E/PowerShellEditorServices.Test.E2E.csproj
index 5f7618193..a20809070 100644
--- a/test/PowerShellEditorServices.Test.E2E/PowerShellEditorServices.Test.E2E.csproj
+++ b/test/PowerShellEditorServices.Test.E2E/PowerShellEditorServices.Test.E2E.csproj
@@ -10,13 +10,26 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/PowerShellEditorServices.Test/Language/CompletionHandlerTests.cs b/test/PowerShellEditorServices.Test/Language/CompletionHandlerTests.cs
index c7cb1765b..d47afa38e 100644
--- a/test/PowerShellEditorServices.Test/Language/CompletionHandlerTests.cs
+++ b/test/PowerShellEditorServices.Test/Language/CompletionHandlerTests.cs
@@ -53,19 +53,17 @@ private Task GetCompletionResultsAsync(ScriptRegion scriptReg
CancellationToken.None);
}
- [SkippableFact]
+ [Fact]
public async Task CompletesCommandInFile()
{
- Skip.If(VersionUtils.PSEdition == "Core", "OmniSharp records are broken!");
(_, IEnumerable results) = await GetCompletionResultsAsync(CompleteCommandInFile.SourceDetails).ConfigureAwait(true);
CompletionItem actual = Assert.Single(results);
Assert.Equal(CompleteCommandInFile.ExpectedCompletion, actual);
}
- [SkippableFact]
+ [Fact]
public async Task CompletesCommandFromModule()
{
- Skip.If(VersionUtils.PSEdition == "Core", "OmniSharp records are broken!");
(_, IEnumerable results) = await GetCompletionResultsAsync(CompleteCommandFromModule.SourceDetails).ConfigureAwait(true);
CompletionItem actual = Assert.Single(results);
// NOTE: The tooltip varies across PowerShell and OS versions, so we ignore it.
@@ -76,7 +74,6 @@ public async Task CompletesCommandFromModule()
[SkippableFact]
public async Task CompletesTypeName()
{
- Skip.If(VersionUtils.PSEdition == "Core", "OmniSharp records are broken!");
Skip.If(VersionUtils.PSEdition == "Desktop", "Windows PowerShell has trouble with this test right now.");
(_, IEnumerable results) = await GetCompletionResultsAsync(CompleteTypeName.SourceDetails).ConfigureAwait(true);
CompletionItem actual = Assert.Single(results);
@@ -98,26 +95,23 @@ public async Task CompletesTypeName()
[SkippableFact]
public async Task CompletesNamespace()
{
- Skip.If(VersionUtils.PSEdition == "Core", "OmniSharp records are broken!");
Skip.If(VersionUtils.PSEdition == "Desktop", "Windows PowerShell has trouble with this test right now.");
(_, IEnumerable results) = await GetCompletionResultsAsync(CompleteNamespace.SourceDetails).ConfigureAwait(true);
CompletionItem actual = Assert.Single(results);
Assert.Equal(CompleteNamespace.ExpectedCompletion, actual);
}
- [SkippableFact]
+ [Fact]
public async Task CompletesVariableInFile()
{
- Skip.If(VersionUtils.PSEdition == "Core", "OmniSharp records are broken!");
(_, IEnumerable results) = await GetCompletionResultsAsync(CompleteVariableInFile.SourceDetails).ConfigureAwait(true);
CompletionItem actual = Assert.Single(results);
Assert.Equal(CompleteVariableInFile.ExpectedCompletion, actual);
}
- [SkippableFact]
+ [Fact]
public async Task CompletesAttributeValue()
{
- Skip.If(VersionUtils.PSEdition == "Core", "OmniSharp records are broken!");
(_, IEnumerable results) = await GetCompletionResultsAsync(CompleteAttributeValue.SourceDetails).ConfigureAwait(true);
// NOTE: Since the completions come through un-ordered from PowerShell, their SortText
// (which has an index prepended from the original order) will mis-match our assumed
@@ -128,10 +122,9 @@ public async Task CompletesAttributeValue()
actual => Assert.Equal(actual with { Data = null, SortText = null }, CompleteAttributeValue.ExpectedCompletion3));
}
- [SkippableFact]
+ [Fact]
public async Task CompletesFilePath()
{
- Skip.If(VersionUtils.PSEdition == "Core", "OmniSharp records are broken!");
(_, IEnumerable results) = await GetCompletionResultsAsync(CompleteFilePath.SourceDetails).ConfigureAwait(true);
Assert.NotEmpty(results);
CompletionItem actual = results.First();
diff --git a/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj b/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj
index 26323a8d6..9a32254b9 100644
--- a/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj
+++ b/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj
@@ -41,7 +41,6 @@
-
diff --git a/test/PowerShellEditorServices.Test/Services/Symbols/PSScriptAnalyzerTests.cs b/test/PowerShellEditorServices.Test/Services/Symbols/PSScriptAnalyzerTests.cs
index 3f9a7ecb7..ca3f3ae04 100644
--- a/test/PowerShellEditorServices.Test/Services/Symbols/PSScriptAnalyzerTests.cs
+++ b/test/PowerShellEditorServices.Test/Services/Symbols/PSScriptAnalyzerTests.cs
@@ -8,7 +8,6 @@
using Microsoft.PowerShell.EditorServices.Services;
using Microsoft.PowerShell.EditorServices.Services.TextDocument;
using Microsoft.PowerShell.EditorServices.Test;
-using Microsoft.PowerShell.EditorServices.Utility;
using Xunit;
namespace PowerShellEditorServices.Test.Services.Symbols
@@ -66,10 +65,9 @@ public async Task CanLoadPSScriptAnalyzerAsync()
});
}
- [SkippableFact]
+ [Fact]
public async Task DoesNotDuplicateScriptMarkersAsync()
{
- Skip.If(VersionUtils.PSEdition == "Core", "OmniSharp records are broken!");
ScriptFile scriptFile = workspaceService.GetFileBuffer("untitled:Untitled-1", script);
ScriptFile[] scriptFiles = { scriptFile };
@@ -85,10 +83,9 @@ await analysisService
Assert.Single(scriptFile.DiagnosticMarkers);
}
- [SkippableFact]
+ [Fact]
public async Task DoesNotClearParseErrorsAsync()
{
- Skip.If(VersionUtils.PSEdition == "Core", "OmniSharp records are broken!");
// Causing a missing closing } parser error
ScriptFile scriptFile = workspaceService.GetFileBuffer("untitled:Untitled-2", script.TrimEnd('}'));
ScriptFile[] scriptFiles = { scriptFile };