diff --git a/PowerShellEditorServices.build.ps1 b/PowerShellEditorServices.build.ps1 index 458e88ce1..e67e1c63f 100644 --- a/PowerShellEditorServices.build.ps1 +++ b/PowerShellEditorServices.build.ps1 @@ -34,7 +34,7 @@ if ($PSVersionTable.PSEdition -ne "Core") { task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestPowerShellApi { - $requiredSdkVersion = "2.0.0" + $requiredSdkVersion = (Get-Content (Join-Path $PSScriptRoot 'global.json') | ConvertFrom-Json).sdk.version $dotnetPath = "$PSScriptRoot/.dotnet" $dotnetExePath = if ($script:IsUnix) { "$dotnetPath/dotnet" } else { "$dotnetPath/dotnet.exe" } @@ -52,10 +52,8 @@ task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestP # Make sure the dotnet we found is the right version 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) { + # dotnet --version can write to stderr, which causes builds to abort, therefore use --list-sdks instead + if ((& $dotnetExePath --list-sdks | ForEach-Object { $_.Split()[0] } ) -contains $requiredSdkVersion) { $script:dotnetExe = $dotnetExePath } else { diff --git a/global.json b/global.json new file mode 100644 index 000000000..0c8476678 --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "2.1.801" + } +} diff --git a/modules.json b/modules.json index 8777ca207..df8ff6935 100644 --- a/modules.json +++ b/modules.json @@ -1,6 +1,6 @@ { "PSScriptAnalyzer":{ - "MinimumVersion":"1.18.2", + "MinimumVersion":"1.18.3", "MaximumVersion":"1.99", "AllowPrerelease":false }, diff --git a/src/PowerShellEditorServices.Protocol/Server/LanguageServerSettings.cs b/src/PowerShellEditorServices.Protocol/Server/LanguageServerSettings.cs index 6106fb25c..2c1d0b7df 100644 --- a/src/PowerShellEditorServices.Protocol/Server/LanguageServerSettings.cs +++ b/src/PowerShellEditorServices.Protocol/Server/LanguageServerSettings.cs @@ -264,6 +264,7 @@ private Hashtable GetCustomPSSASettingsHashtable(int tabSize, bool insertSpaces) {"PSUseConsistentIndentation", new Hashtable { {"Enable", true}, {"IndentationSize", tabSize}, + {"PipelineIndentation", PipelineIndentationStyle }, {"Kind", insertSpaces ? "space" : "tab"} }}, {"PSUseConsistentWhitespace", new Hashtable {