From d1ebe37ffa977ab454aa2f78545a3b6808f21b49 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Mon, 16 Nov 2020 16:21:07 -0800 Subject: [PATCH 1/2] Add ChangePrefixNegationToInfixSubtraction code fixeroo (#10471) --- .../ChangePrefixNegationToInfixSubtraction.fs | 55 +++++++++++++++++++ .../src/FSharp.Editor/FSharp.Editor.fsproj | 1 + .../src/FSharp.Editor/FSharp.Editor.resx | 3 + .../FSharp.Editor/xlf/FSharp.Editor.cs.xlf | 5 ++ .../FSharp.Editor/xlf/FSharp.Editor.de.xlf | 5 ++ .../FSharp.Editor/xlf/FSharp.Editor.es.xlf | 5 ++ .../FSharp.Editor/xlf/FSharp.Editor.fr.xlf | 5 ++ .../FSharp.Editor/xlf/FSharp.Editor.it.xlf | 5 ++ .../FSharp.Editor/xlf/FSharp.Editor.ja.xlf | 5 ++ .../FSharp.Editor/xlf/FSharp.Editor.ko.xlf | 5 ++ .../FSharp.Editor/xlf/FSharp.Editor.pl.xlf | 5 ++ .../FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf | 5 ++ .../FSharp.Editor/xlf/FSharp.Editor.ru.xlf | 5 ++ .../FSharp.Editor/xlf/FSharp.Editor.tr.xlf | 5 ++ .../xlf/FSharp.Editor.zh-Hans.xlf | 5 ++ .../xlf/FSharp.Editor.zh-Hant.xlf | 5 ++ 16 files changed, 124 insertions(+) create mode 100644 vsintegration/src/FSharp.Editor/CodeFix/ChangePrefixNegationToInfixSubtraction.fs diff --git a/vsintegration/src/FSharp.Editor/CodeFix/ChangePrefixNegationToInfixSubtraction.fs b/vsintegration/src/FSharp.Editor/CodeFix/ChangePrefixNegationToInfixSubtraction.fs new file mode 100644 index 00000000000..79d41ccbf16 --- /dev/null +++ b/vsintegration/src/FSharp.Editor/CodeFix/ChangePrefixNegationToInfixSubtraction.fs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Microsoft.VisualStudio.FSharp.Editor + +open System +open System.Composition +open System.Threading.Tasks + +open Microsoft.CodeAnalysis.Text +open Microsoft.CodeAnalysis.CodeFixes + +[] +type internal FSharpChangePrefixNegationToInfixSubtractionodeFixProvider() = + inherit CodeFixProvider() + + let fixableDiagnosticIds = set ["FS0003"] + + override _.FixableDiagnosticIds = Seq.toImmutableArray fixableDiagnosticIds + + override _.RegisterCodeFixesAsync context : Task = + asyncMaybe { + let diagnostics = + context.Diagnostics + |> Seq.filter (fun x -> fixableDiagnosticIds |> Set.contains x.Id) + |> Seq.toImmutableArray + + let! sourceText = context.Document.GetTextAsync(context.CancellationToken) + + let mutable pos = context.Span.End + 1 + + // This won't ever actually happen, but eh why not + do! Option.guard (pos < sourceText.Length) + + let mutable ch = sourceText.GetSubText(TextSpan(pos, 1)).ToString().[0] + + while pos < sourceText.Length && Char.IsWhiteSpace(ch) do + pos <- pos + 1 + let text = sourceText.GetSubText(TextSpan(pos, 1)) + ch <- text.ToString().[0] + + // Bail if this isn't a negation + do! Option.guard (ch = '-') + + let title = SR.ChangePrefixNegationToInfixSubtraction() + + let codeFix = + CodeFixHelpers.createTextChangeCodeFix( + title, + context, + (fun () -> asyncMaybe.Return [| TextChange(TextSpan(pos, 1), "- ") |])) + + context.RegisterCodeFix(codeFix, diagnostics) + } + |> Async.Ignore + |> RoslynHelpers.StartAsyncUnitAsTask(context.CancellationToken) \ No newline at end of file diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj index 8bc59c35a19..78cc9a5d518 100644 --- a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj +++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj @@ -89,6 +89,7 @@ + diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.resx b/vsintegration/src/FSharp.Editor/FSharp.Editor.resx index 8440136cf33..13709945ce2 100644 --- a/vsintegration/src/FSharp.Editor/FSharp.Editor.resx +++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.resx @@ -219,4 +219,7 @@ F# Dispostable Values (top-level) + + Use subtraction instead of negation + \ No newline at end of file diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf index 4166b0f2341..3f88b1c720e 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf @@ -7,6 +7,11 @@ Přidejte klíčové slovo new. + + Use subtraction instead of negation + Use subtraction instead of negation + + F# Disposable Values (locals) Uvolnitelné hodnoty jazyka F# (místní) diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf index 07e6d727ab7..3688348de79 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf @@ -7,6 +7,11 @@ Schlüsselwort "new" hinzufügen + + Use subtraction instead of negation + Use subtraction instead of negation + + F# Disposable Values (locals) Disposable-Werte in F# (lokal) diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf index 938718cd84d..25dd2a86c06 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf @@ -7,6 +7,11 @@ Agregar "nueva" palabra clave + + Use subtraction instead of negation + Use subtraction instead of negation + + F# Disposable Values (locals) Valores de F# descartables (locales) diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf index b98cc518175..b86e842de07 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf @@ -7,6 +7,11 @@ Ajouter le mot clé 'new' + + Use subtraction instead of negation + Use subtraction instead of negation + + F# Disposable Values (locals) Valeurs F# pouvant être supprimées (variables locales) diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf index 2d5be7acb75..e39eae13e4f 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf @@ -7,6 +7,11 @@ Aggiungi la parola chiave 'new' + + Use subtraction instead of negation + Use subtraction instead of negation + + F# Disposable Values (locals) Valori eliminabili F# (variabili locali) diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf index 9ba0736cd88..fa9e2640c6a 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf @@ -7,6 +7,11 @@ 'new' キーワードを追加する + + Use subtraction instead of negation + Use subtraction instead of negation + + F# Disposable Values (locals) F# の破棄可能な値 (ローカル) diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf index 92345097f88..8d004350bfe 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf @@ -7,6 +7,11 @@ 'new' 키워드 추가 + + Use subtraction instead of negation + Use subtraction instead of negation + + F# Disposable Values (locals) F# 삭제 가능한 값(로컬) diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf index 60ff55ee7e7..263f33a5269 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf @@ -7,6 +7,11 @@ Dodaj słowo kluczowe „new” + + Use subtraction instead of negation + Use subtraction instead of negation + + F# Disposable Values (locals) Wartości możliwe do likwidacji języka F# (lokalne) diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf index 273b1dbc606..fb4600b9227 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf @@ -7,6 +7,11 @@ Adicionar a palavra-chave 'new' + + Use subtraction instead of negation + Use subtraction instead of negation + + F# Disposable Values (locals) Valores F# Descartáveis (locais) diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf index 86dd262725a..9982dfa1fe6 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf @@ -7,6 +7,11 @@ Добавить ключевое слово "new" + + Use subtraction instead of negation + Use subtraction instead of negation + + F# Disposable Values (locals) Освобождаемые значения F# (локальные) diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf index 371667a5576..edbc805cf1f 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf @@ -7,6 +7,11 @@ 'new' anahtar sözcüğünü ekleme + + Use subtraction instead of negation + Use subtraction instead of negation + + F# Disposable Values (locals) F# Atılabilir Değerleri (yereller) diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf index ecdb487c0a1..c52791002ea 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf @@ -7,6 +7,11 @@ 添加“新”关键字 + + Use subtraction instead of negation + Use subtraction instead of negation + + F# Disposable Values (locals) F# 可释放值(局部值) diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf index 3c3e49970af..69df9f10ee7 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf @@ -7,6 +7,11 @@ 新增 'new' 關鍵字 + + Use subtraction instead of negation + Use subtraction instead of negation + + F# Disposable Values (locals) F# 可處置的值 (區域) From ca464f8894468c6e80ee61d84e8ccff7769f69fd Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Mon, 16 Nov 2020 16:42:07 -0800 Subject: [PATCH 2/2] migrate version calculations from release/16.9 (#10479) --- azure-pipelines.yml | 12 +++++++++++- eng/MockBuild.ps1 | 15 +++++++++++++++ eng/Versions.props | 17 ++++++++++++----- src/fsharp/FSharp.Core/Directory.Build.props | 9 +++++++++ src/fsharp/FSharp.Core/FSharp.Core.fsproj | 1 + 5 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 eng/MockBuild.ps1 create mode 100644 src/fsharp/FSharp.Core/Directory.Build.props diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 169a7cba5ec..e9e1a3506ef 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -239,6 +239,16 @@ stages: continueOnError: true condition: failed() + # Mock official build + - job: MockOfficial + pool: + vmImage: windows-2019 + steps: + - checkout: self + clean: true + - pwsh: .\eng\MockBuild.ps1 + displayName: Build with OfficialBuildId + # Linux - job: Linux pool: @@ -311,7 +321,7 @@ stages: - checkout: self clean: true - script: .\Build.cmd -c Release - - script: .\tests\EndToEndBuildTests\EndToEndBuildTests -c Release + - script: .\tests\EndToEndBuildTests\EndToEndBuildTests.cmd -c Release displayName: End to end build tests # Source Build Windows diff --git a/eng/MockBuild.ps1 b/eng/MockBuild.ps1 new file mode 100644 index 00000000000..e8000edb45f --- /dev/null +++ b/eng/MockBuild.ps1 @@ -0,0 +1,15 @@ +Set-StrictMode -version 2.0 +$ErrorActionPreference = "Stop" + +try { + $fakeBuildId = (Get-Date -Format "yyyyMMdd") + ".0" + $visualStudioDropName = "Products/mock/dotnet-fsharp/branch/$fakeBuildId" + & "$PSScriptRoot\Build.ps1" -build -restore -ci -bootstrap -binaryLog -pack -configuration Release /p:OfficialBuildId=$fakeBuildId /p:VisualStudioDropName=$visualStudioDropName +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + Write-Host "##[error](NETCORE_ENGINEERING_TELEMETRY=Build) Error doing mock official build." + exit 1 +} diff --git a/eng/Versions.props b/eng/Versions.props index f3177c231df..9ae72287066 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -12,17 +12,21 @@ beta + 5 0 - 0 + 1 0 + $(FSMajorVersion).$(FSMinorVersion) $(FSMajorVersion)-$(FSMinorVersion) + $(FSMajorVersion).$(FSMinorVersion) $(FSMajorVersion).$(FSMinorVersion).$(FSBuildVersion) $(FSMajorVersion)-$(FSMinorVersion)-$(FSBuildVersion) $(FSMajorVersion).$(FSMinorVersion).$(FSBuildVersion) - $(FSMajorVersion).$(FSMinorVersion).$(FSBuildVersion).$(FSRevisionVersion) + $(FSMajorVersion).$(FSMinorVersion).0.0 + 38 $(FSMinorVersion) $(FSBuildVersion) @@ -49,13 +53,16 @@ $(VSAssemblyVersionPrefix).0 - + + $(FSCoreVersionPrefix) + $(FSCoreVersion) + + $(FSCoreVersionPrefix) - $(FSCorePackageVersion) $(FSProductVersionPrefix) $(VSAssemblyVersionPrefix) $(FSharpCompilerServicePackageVersion) - $(VersionPrefix).0 + $(VersionPrefix).0 diff --git a/src/fsharp/FSharp.Core/Directory.Build.props b/src/fsharp/FSharp.Core/Directory.Build.props new file mode 100644 index 00000000000..7509ab35a14 --- /dev/null +++ b/src/fsharp/FSharp.Core/Directory.Build.props @@ -0,0 +1,9 @@ + + + + true + + + + + diff --git a/src/fsharp/FSharp.Core/FSharp.Core.fsproj b/src/fsharp/FSharp.Core/FSharp.Core.fsproj index 369dfa3289c..8f2da7734fb 100644 --- a/src/fsharp/FSharp.Core/FSharp.Core.fsproj +++ b/src/fsharp/FSharp.Core/FSharp.Core.fsproj @@ -15,6 +15,7 @@ true FSharp.Core + $(FSCorePackageVersion) FSharp.Core.nuspec true FSharp.Core redistributables from F# Tools version $(FSCorePackageVersion) For F# $(FSLanguageVersion). Contains code from the F# Software Foundation.