From 254039926f7f126dd405cc58d380b5af722ae853 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 29 Oct 2019 18:26:22 -0700 Subject: [PATCH 1/5] New colors supported by PS7 (#1064) --- .../Session/Host/EditorServicesPSHost.cs | 22 +++++++++++++++++++ .../Host/EditorServicesPSHostUserInterface.cs | 3 +++ 2 files changed, 25 insertions(+) diff --git a/src/PowerShellEditorServices/Session/Host/EditorServicesPSHost.cs b/src/PowerShellEditorServices/Session/Host/EditorServicesPSHost.cs index 33925f044..f81c5393f 100644 --- a/src/PowerShellEditorServices/Session/Host/EditorServicesPSHost.cs +++ b/src/PowerShellEditorServices/Session/Host/EditorServicesPSHost.cs @@ -87,6 +87,28 @@ internal ConsoleColorProxy(EditorServicesPSHostUserInterface hostUserInterface) _hostUserInterface = hostUserInterface; } + /// + /// The Accent Color for Formatting + /// + public ConsoleColor FormatAccentColor + { + get + { return _hostUserInterface.FormatAccentColor; } + set + { _hostUserInterface.FormatAccentColor = value; } + } + + /// + /// The Accent Color for Error + /// + public ConsoleColor ErrorAccentColor + { + get + { return _hostUserInterface.ErrorAccentColor; } + set + { _hostUserInterface.ErrorAccentColor = value; } + } + /// /// The ForegroundColor for Error /// diff --git a/src/PowerShellEditorServices/Session/Host/EditorServicesPSHostUserInterface.cs b/src/PowerShellEditorServices/Session/Host/EditorServicesPSHostUserInterface.cs index 2aceaaf10..4dd1bbe40 100644 --- a/src/PowerShellEditorServices/Session/Host/EditorServicesPSHostUserInterface.cs +++ b/src/PowerShellEditorServices/Session/Host/EditorServicesPSHostUserInterface.cs @@ -690,6 +690,9 @@ private void WriteDebuggerBanner(DebuggerStopEventArgs eventArgs) internal static ConsoleColor BackgroundColor { get; set; } + internal ConsoleColor FormatAccentColor { get; set; } = ConsoleColor.Green; + internal ConsoleColor ErrorAccentColor { get; set; } = ConsoleColor.Cyan; + internal ConsoleColor ErrorForegroundColor { get; set; } = ConsoleColor.Red; internal ConsoleColor ErrorBackgroundColor { get; set; } = BackgroundColor; From b917c8548eaec1828193893f54ef27467e618780 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Wed, 30 Oct 2019 17:09:59 -0700 Subject: [PATCH 2/5] switch to maxRequiredVersion --- PowerShellEditorServices.build.ps1 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/PowerShellEditorServices.build.ps1 b/PowerShellEditorServices.build.ps1 index 458e88ce1..dd8b7e58a 100644 --- a/PowerShellEditorServices.build.ps1 +++ b/PowerShellEditorServices.build.ps1 @@ -34,7 +34,8 @@ if ($PSVersionTable.PSEdition -ne "Core") { task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestPowerShellApi { - $requiredSdkVersion = "2.0.0" + $minRequiredSdkVersion = "2.0.0" + $maxRequiredSdkVersion = "3.0.0" $dotnetPath = "$PSScriptRoot/.dotnet" $dotnetExePath = if ($script:IsUnix) { "$dotnetPath/dotnet" } else { "$dotnetPath/dotnet.exe" } @@ -54,8 +55,8 @@ task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestP if ($dotnetExePath) { # dotnet --version can return a semver that System.Version can't handle # e.g.: 2.1.300-preview-01. The replace operator is used to remove any build suffix. - $version = (& $dotnetExePath --version) -replace '[+-].*$','' - if ([version]$version -ge [version]$requiredSdkVersion) { + $version = [version]((& $dotnetExePath --version) -replace '[+-].*$','') + if ($version -ge [version]$minRequiredSdkVersion -and $version -lt $maxRequiredSdkVersion) { $script:dotnetExe = $dotnetExePath } else { @@ -70,7 +71,7 @@ task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestP if ($script:dotnetExe -eq $null) { - Write-Host "`n### Installing .NET CLI $requiredSdkVersion...`n" -ForegroundColor Green + Write-Host "`n### Installing .NET CLI $minRequiredSdkVersion...`n" -ForegroundColor Green # The install script is platform-specific $installScriptExt = if ($script:IsUnix) { "sh" } else { "ps1" } @@ -81,10 +82,10 @@ task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestP $env:DOTNET_INSTALL_DIR = "$PSScriptRoot/.dotnet" if (!$script:IsUnix) { - & $installScriptPath -Version $requiredSdkVersion -InstallDir "$env:DOTNET_INSTALL_DIR" + & $installScriptPath -Version $minRequiredSdkVersion -InstallDir "$env:DOTNET_INSTALL_DIR" } else { - & /bin/bash $installScriptPath -Version $requiredSdkVersion -InstallDir "$env:DOTNET_INSTALL_DIR" + & /bin/bash $installScriptPath -Version $minRequiredSdkVersion -InstallDir "$env:DOTNET_INSTALL_DIR" $env:PATH = $dotnetExeDir + [System.IO.Path]::PathSeparator + $env:PATH } From c556500fc7ecb74f3fa8ce14846cbbc8434a118b Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Wed, 30 Oct 2019 17:14:33 -0700 Subject: [PATCH 3/5] rework max --- PowerShellEditorServices.build.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PowerShellEditorServices.build.ps1 b/PowerShellEditorServices.build.ps1 index dd8b7e58a..0a59bad52 100644 --- a/PowerShellEditorServices.build.ps1 +++ b/PowerShellEditorServices.build.ps1 @@ -35,7 +35,6 @@ if ($PSVersionTable.PSEdition -ne "Core") { task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestPowerShellApi { $minRequiredSdkVersion = "2.0.0" - $maxRequiredSdkVersion = "3.0.0" $dotnetPath = "$PSScriptRoot/.dotnet" $dotnetExePath = if ($script:IsUnix) { "$dotnetPath/dotnet" } else { "$dotnetPath/dotnet.exe" } @@ -56,6 +55,9 @@ task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestP # dotnet --version can return a semver that System.Version can't handle # e.g.: 2.1.300-preview-01. The replace operator is used to remove any build suffix. $version = [version]((& $dotnetExePath --version) -replace '[+-].*$','') + $maxRequiredSdkVersion = [version]::Parse("3.0.0") + + # $minRequiredSdkVersion <= version < $maxRequiredSdkVersion if ($version -ge [version]$minRequiredSdkVersion -and $version -lt $maxRequiredSdkVersion) { $script:dotnetExe = $dotnetExePath } From 6be1fc89dab9456a14aed318e8f380e32d1b8362 Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Thu, 31 Oct 2019 10:53:37 -0700 Subject: [PATCH 4/5] Apply whitespace suggestions from code review Co-Authored-By: Steve Lee Co-Authored-By: Tyler James Leonhardt --- .../Session/Host/EditorServicesPSHost.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/PowerShellEditorServices/Session/Host/EditorServicesPSHost.cs b/src/PowerShellEditorServices/Session/Host/EditorServicesPSHost.cs index f81c5393f..93622f1ab 100644 --- a/src/PowerShellEditorServices/Session/Host/EditorServicesPSHost.cs +++ b/src/PowerShellEditorServices/Session/Host/EditorServicesPSHost.cs @@ -93,9 +93,14 @@ internal ConsoleColorProxy(EditorServicesPSHostUserInterface hostUserInterface) public ConsoleColor FormatAccentColor { get - { return _hostUserInterface.FormatAccentColor; } + { + return _hostUserInterface.FormatAccentColor; + } + set - { _hostUserInterface.FormatAccentColor = value; } + { + _hostUserInterface.FormatAccentColor = value; + } } /// From 99e99b9d410d2e934a7cdb257e287adf44b92c90 Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Thu, 31 Oct 2019 10:57:20 -0700 Subject: [PATCH 5/5] Fix style --- .../Session/Host/EditorServicesPSHost.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/PowerShellEditorServices/Session/Host/EditorServicesPSHost.cs b/src/PowerShellEditorServices/Session/Host/EditorServicesPSHost.cs index 93622f1ab..614e4d636 100644 --- a/src/PowerShellEditorServices/Session/Host/EditorServicesPSHost.cs +++ b/src/PowerShellEditorServices/Session/Host/EditorServicesPSHost.cs @@ -109,9 +109,14 @@ public ConsoleColor FormatAccentColor public ConsoleColor ErrorAccentColor { get - { return _hostUserInterface.ErrorAccentColor; } + { + return _hostUserInterface.ErrorAccentColor; + } + set - { _hostUserInterface.ErrorAccentColor = value; } + { + _hostUserInterface.ErrorAccentColor = value; + } } ///