diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0593975bb57b8479e15e32a9c26ddb88ec6bab96..b287c5c16e69cb2252805e7ec7e1f155b655f17b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -571,8 +571,8 @@ stages: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - template: eng/release/insert-into-vs.yml parameters: - componentBranchName: refs/heads/release/dev17.0 - insertTargetBranch: rel/d17.0 + componentBranchName: refs/heads/release/dev17.2 + insertTargetBranch: rel/d17.2 insertTeamEmail: fsharpteam@microsoft.com insertTeamName: 'F#' completeInsertion: 'auto' diff --git a/eng/Versions.props b/eng/Versions.props index 87774bad87e2b73186982ee3c07e3d182ec71270..6571c5fb21a38b635bad7c66c7fe03734d7b54c3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 6 0 - 1 + 5 0 @@ -32,14 +32,14 @@ 41 0 - 1 + 5 $(FSRevisionVersion) $(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion) $(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion).$(FCSRevisionVersion) $(FCSMajorVersion)$(FCSMinorVersion)$(FCSBuildVersion) - 6.0.1 + 6.0.3 $(FSCorePackageVersionValue)-$(PreReleaseVersionLabel).* @@ -47,7 +47,7 @@ 12 0 - 0 + 4 $(FSRevisionVersion) $(FSToolsMajorVersion).$(FSToolsMinorVersion).$(FSToolsBuildVersion) $(FSToolsMajorVersion)-$(FSToolsMinorVersion)-$(FSToolsBuildVersion) @@ -55,7 +55,7 @@ 17 - 0 + 1 $(VSMajorVersion).0 $(VSMajorVersion).$(VSMinorVersion).0 $(VSAssemblyVersionPrefix).0 @@ -135,7 +135,7 @@ $(VisualStudioContractPackagesVersion) $(VisualStudioContractPackagesVersion) - 4.2.0-2.22103.11 + 4.2.0-3.22154.1 $(RoslynVersion) $(RoslynVersion) $(RoslynVersion) @@ -189,6 +189,7 @@ $(VisualStudioContractPackagesVersion) 17.0.46 9.0.30729 + 6.0.0 12.0.4 7.0.4 8.0.4 @@ -212,6 +213,7 @@ 13.0.1 3.13.2 4.1.0 + 3.11.0 2.1.80 1.0.0-beta2-dev3 2.11.34 diff --git a/src/Compiler/Driver/OptimizeInputs.fs b/src/Compiler/Driver/OptimizeInputs.fs index f2ce410199b9b206504522009bb266050f7db781..c3ab6ff05feb541463ce6cc47dd1222724ea23e7 100644 --- a/src/Compiler/Driver/OptimizeInputs.fs +++ b/src/Compiler/Driver/OptimizeInputs.fs @@ -245,7 +245,7 @@ let GenerateIlxCode generateFilterBlocks = tcConfig.generateFilterBlocks emitConstantArraysUsingStaticDataBlobs = not isInteractiveOnMono workAroundReflectionEmitBugs = tcConfig.isInteractive - generateDebugSymbols = tcConfig.debuginfo + generateDebugSymbols = tcConfig.debuginfo // REVIEW: is this still required? fragName = fragName localOptimizationsEnabled = tcConfig.optSettings.LocalOptimizationsEnabled testFlagEmitFeeFeeAs100001 = tcConfig.testFlagEmitFeeFeeAs100001 diff --git a/src/FSharp.Core/FSharp.Core.fsproj b/src/FSharp.Core/FSharp.Core.fsproj index c5fc82dfebd77cf7f98ad526a4ccc00913f8de2b..d1676b61576b19ed8e033d06024dd4de3efe1c27 100644 --- a/src/FSharp.Core/FSharp.Core.fsproj +++ b/src/FSharp.Core/FSharp.Core.fsproj @@ -13,21 +13,18 @@ BUILDING_WITH_LKG;$(DefineConstants) $(OtherFlags) --warnon:3218 - - $(OtherFlags) --warnon:1182 - - $(OtherFlags) --warnon:3390 - - $(OtherFlags) --warnon:3520 $(OtherFlags) --warnon:1182 $(OtherFlags) --warnon:3390 + + $(OtherFlags) --warnon:3520 $(OtherFlags) --nowarn:57 + $(OtherFlags) --nowarn:3511 - $(OtherFlags) --nowarn:3511 --nowarn:3513 + $(OtherFlags) --nowarn:3513 $(OtherFlags) --compiling-fslib --compiling-fslib-40 --maxerrors:100 --extraoptimizationloops:1 preview diff --git a/src/FSharp.Core/prim-types.fsi b/src/FSharp.Core/prim-types.fsi index af9b1c1e5a3851df4da5dfdbf25cf3a6207c5d2c..70ee63e0c2dc910080197629e403fe83cbee23ae 100644 --- a/src/FSharp.Core/prim-types.fsi +++ b/src/FSharp.Core/prim-types.fsi @@ -1027,7 +1027,7 @@ namespace Microsoft.FSharp.Core /// Basic Types with Units of Measure [] type byte<[] 'Measure> = byte - + /// The type of 16-bit unsigned integer numbers, annotated with a unit of measure. /// The unit of measure is erased in compiled code and when values of this type /// are analyzed using reflection. The type is representationally equivalent to @@ -1036,7 +1036,7 @@ namespace Microsoft.FSharp.Core /// Basic Types with Units of Measure [] type uint16<[] 'Measure> = uint16 - + /// The type of 64-bit unsigned integer numbers, annotated with a unit of measure. /// The unit of measure is erased in compiled code and when values of this type /// are analyzed using reflection. The type is representationally equivalent to @@ -1045,7 +1045,7 @@ namespace Microsoft.FSharp.Core /// Basic Types with Units of Measure [] type uint64<[] 'Measure> = uint64 - + /// The type of machine-sized unsigned integer numbers, annotated with a unit of measure. /// The unit of measure is erased in compiled code and when values of this type /// are analyzed using reflection. The type is representationally equivalent to @@ -1054,7 +1054,7 @@ namespace Microsoft.FSharp.Core /// Basic Types with Units of Measure [] type unativeint<[] 'Measure> = unativeint - + /// The type of double-precision floating point numbers, annotated with a unit of measure. /// The unit of measure is erased in compiled code and when values of this type /// are analyzed using reflection. The type is representationally equivalent to diff --git a/src/FSharp.Core/printf.fsi b/src/FSharp.Core/printf.fsi index 0171baecad668bfe30196047882b6531ea947376..dc9d8b9a629a2b418db9b5f3e926e0a8aec28fb3 100644 --- a/src/FSharp.Core/printf.fsi +++ b/src/FSharp.Core/printf.fsi @@ -35,8 +35,10 @@ type PrintfFormat<'Printer, 'State, 'Residue, 'Result> = /// The raw text of the format string. member Value: string + /// The captures associated with an interpolated string. member Captures: obj[] + /// The capture types associated with an interpolated string. member CaptureTypes: System.Type[] /// Type of a formatting expression. diff --git a/vsintegration/src/FSharp.Editor/Formatting/EditorFormattingService.fs b/vsintegration/src/FSharp.Editor/Formatting/EditorFormattingService.fs index 62f33880302fb5f4820c26bbe6f42be439ea78f9..a21a230d617775039b49ee3048e0e694bcc796cc 100644 --- a/vsintegration/src/FSharp.Editor/Formatting/EditorFormattingService.fs +++ b/vsintegration/src/FSharp.Editor/Formatting/EditorFormattingService.fs @@ -167,14 +167,17 @@ type internal FSharpEditorFormattingService return textChanges |> Option.defaultValue Seq.empty |> toIList } - interface IFSharpEditorFormattingService with + interface IFSharpEditorFormattingServiceWithOptions with member val SupportsFormatDocument = false member val SupportsFormatSelection = false member val SupportsFormatOnPaste = true member val SupportsFormatOnReturn = true - override _.SupportsFormattingOnTypedCharacter (document, ch) = - if FSharpIndentationService.IsSmartIndentEnabled document.Project.Solution.Workspace.Options then + override _.SupportsFormattingOnTypedCharacter (_document, _ch) = + false + + override _.SupportsFormattingOnTypedCharacter (_document, options, ch) = + if options.IndentStyle = FormattingOptions.IndentStyle.Smart then match ch with | ')' | ']' | '}' -> true | _ -> false diff --git a/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs b/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs index ec73168c1f75e0b202cdcecd5ce66abdec37f8a8..c0c4ce2b294fbb6e9a06ad24737cb633ecba7e49 100644 --- a/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs +++ b/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs @@ -23,9 +23,6 @@ type internal FSharpIndentationService [] () = - static member IsSmartIndentEnabled (options: Microsoft.CodeAnalysis.Options.OptionSet) = - options.GetOption(FormattingOptions.SmartIndent, FSharpConstants.FSharpLanguageName) = FormattingOptions.IndentStyle.Smart - static member IndentShouldFollow (documentId: DocumentId, sourceText: SourceText, filePath: string, position: int, parsingOptions: FSharpParsingOptions) = let lastTokenOpt = let defines = CompilerEnvironment.GetConditionalDefinesForEditing parsingOptions diff --git a/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs b/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs index 51a9efe99519c18b8d414665778965679df90ef7..dfc56faa5f41cd35f0277e7476110edad107a316 100644 --- a/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs +++ b/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs @@ -3,6 +3,8 @@ namespace Microsoft.VisualStudio.FSharp.Editor open System +open System.Collections.Generic +open System.Collections.Immutable open System.Composition open System.Linq open System.Threading @@ -20,54 +22,42 @@ open FSharp.Compiler.Text open FSharp.Compiler.Tokenization open Symbols -type internal FailureInlineRenameInfo private () = - interface IFSharpInlineRenameInfo with - member _.CanRename = false - member _.LocalizedErrorMessage = FSharpEditorFeaturesResources.You_cannot_rename_this_element - member _.TriggerSpan = Unchecked.defaultof<_> - member _.HasOverloads = false - member _.ForceRenameOverloads = true - member _.DisplayName = "" - member _.FullDisplayName = "" - member _.Glyph = Glyph.MethodPublic - member _.GetFinalSymbolName _ = "" - member _.GetReferenceEditSpan(_, _) = Unchecked.defaultof<_> - member _.GetConflictEditSpan(_, _, _) = Nullable() - member _.FindRenameLocationsAsync(_, _) = Task.FromResult null - member _.TryOnBeforeGlobalSymbolRenamed(_, _, _) = false - member _.TryOnAfterGlobalSymbolRenamed(_, _, _) = false - static member Instance = FailureInlineRenameInfo() :> IFSharpInlineRenameInfo +type internal InlineRenameReplacementInfo(newSolution: Solution, replacementTextValid: bool, documentIds: IEnumerable) = + inherit FSharpInlineRenameReplacementInfo() + + override _.NewSolution = newSolution + override _.ReplacementTextValid = replacementTextValid + override _.DocumentIds = documentIds + override _.GetReplacements _ = Seq.empty type internal InlineRenameLocationSet(locations: FSharpInlineRenameLocation [], originalSolution: Solution, symbolKind: LexerSymbolKind, symbol: FSharpSymbol) = - interface IFSharpInlineRenameLocationSet with - member _.Locations = upcast locations.ToList() - - member _.GetReplacementsAsync(replacementText, _optionSet, cancellationToken) : Task = - let rec applyChanges (solution: Solution) (locationsByDocument: (Document * FSharpInlineRenameLocation list) list) = - async { - match locationsByDocument with - | [] -> return solution - | (document, locations) :: rest -> - let! oldSource = document.GetTextAsync(cancellationToken) |> Async.AwaitTask - let newSource = oldSource.WithChanges(locations |> List.map (fun l -> TextChange(l.TextSpan, replacementText))) - return! applyChanges (solution.WithDocumentText(document.Id, newSource)) rest - } + inherit FSharpInlineRenameLocationSet() + + override _.Locations = upcast locations.ToList() + override _.GetReplacementsAsync(replacementText, cancellationToken) : Task = + let rec applyChanges (solution: Solution) (locationsByDocument: (Document * FSharpInlineRenameLocation list) list) = async { - let! newSolution = applyChanges originalSolution (locations |> Array.toList |> List.groupBy (fun x -> x.Document)) - let replacementText = - match symbolKind with - | LexerSymbolKind.GenericTypeParameter - | LexerSymbolKind.StaticallyResolvedTypeParameter -> replacementText - | _ -> FSharpKeywords.NormalizeIdentifierBackticks replacementText - return - { new IFSharpInlineRenameReplacementInfo with - member _.NewSolution = newSolution - member _.ReplacementTextValid = Tokenizer.isValidNameForSymbol(symbolKind, symbol, replacementText) - member _.DocumentIds = locations |> Seq.map (fun doc -> doc.Document.Id) |> Seq.distinct - member _.GetReplacements _ = Seq.empty } + match locationsByDocument with + | [] -> return solution + | (document, locations) :: rest -> + let! oldSource = document.GetTextAsync(cancellationToken) |> Async.AwaitTask + let newSource = oldSource.WithChanges(locations |> List.map (fun l -> TextChange(l.TextSpan, replacementText))) + return! applyChanges (solution.WithDocumentText(document.Id, newSource)) rest } - |> RoslynHelpers.StartAsyncAsTask(cancellationToken) + + async { + let! newSolution = applyChanges originalSolution (locations |> Array.toList |> List.groupBy (fun x -> x.Document)) + let replacementText = + match symbolKind with + | LexerSymbolKind.GenericTypeParameter + | LexerSymbolKind.StaticallyResolvedTypeParameter -> replacementText + | _ -> FSharpKeywords.NormalizeIdentifierBackticks replacementText + let replacementTextValid = Tokenizer.isValidNameForSymbol(symbolKind, symbol, replacementText) + let documentIds = locations |> Seq.map (fun doc -> doc.Document.Id) |> Seq.distinct + return new InlineRenameReplacementInfo(newSolution, replacementTextValid, documentIds) :> FSharpInlineRenameReplacementInfo + } + |> RoslynHelpers.StartAsyncAsTask(cancellationToken) type internal InlineRenameInfo ( @@ -79,6 +69,8 @@ type internal InlineRenameInfo checkFileResults: FSharpCheckFileResults ) = + inherit FSharpInlineRenameInfo() + let getDocumentText (document: Document) cancellationToken = match document.TryGetText() with | true, text -> text @@ -88,61 +80,60 @@ type internal InlineRenameInfo SymbolHelpers.getSymbolUsesInSolution(symbolUse.Symbol, declLoc, checkFileResults, document.Project.Solution) |> Async.cache - interface IFSharpInlineRenameInfo with - member _.CanRename = true - member _.LocalizedErrorMessage = null - member _.TriggerSpan = triggerSpan - member _.HasOverloads = false - member _.ForceRenameOverloads = false - member _.DisplayName = symbolUse.Symbol.DisplayName - member _.FullDisplayName = try symbolUse.Symbol.FullName with _ -> symbolUse.Symbol.DisplayName - member _.Glyph = Glyph.MethodPublic - member _.GetFinalSymbolName replacementText = replacementText - - member _.GetReferenceEditSpan(location, cancellationToken) = - let text = getDocumentText location.Document cancellationToken - Tokenizer.fixupSpan(text, location.TextSpan) + override _.CanRename = true + override _.LocalizedErrorMessage = null + override _.TriggerSpan = triggerSpan + override _.HasOverloads = false + override _.ForceRenameOverloads = false + override _.DisplayName = symbolUse.Symbol.DisplayName + override _.FullDisplayName = try symbolUse.Symbol.FullName with _ -> symbolUse.Symbol.DisplayName + override _.Glyph = Glyph.MethodPublic + override _.GetFinalSymbolName replacementText = replacementText + override _.DefinitionLocations = ImmutableArray.Create(new FSharpInlineRenameLocation(document, triggerSpan)) + + override _.GetReferenceEditSpan(location, cancellationToken) = + let text = getDocumentText location.Document cancellationToken + Tokenizer.fixupSpan(text, location.TextSpan) - member _.GetConflictEditSpan(location, replacementText, cancellationToken) = - let text = getDocumentText location.Document cancellationToken - let spanText = text.ToString(location.TextSpan) - let position = spanText.LastIndexOf(replacementText, StringComparison.Ordinal) - if position < 0 then Nullable() - else Nullable(TextSpan(location.TextSpan.Start + position, replacementText.Length)) + override _.GetConflictEditSpan(location, replacementText, cancellationToken) = + let text = getDocumentText location.Document cancellationToken + let spanText = text.ToString(location.TextSpan) + let position = spanText.LastIndexOf(replacementText, StringComparison.Ordinal) + if position < 0 then Nullable() + else Nullable(TextSpan(location.TextSpan.Start + position, replacementText.Length)) - member _.FindRenameLocationsAsync(_optionSet, cancellationToken) = - async { - let! symbolUsesByDocumentId = symbolUses - let! locations = - symbolUsesByDocumentId - |> Seq.map (fun (KeyValue(documentId, symbolUses)) -> - async { - let document = document.Project.Solution.GetDocument(documentId) - let! sourceText = document.GetTextAsync(cancellationToken) |> Async.AwaitTask - return - [| for symbolUse in symbolUses do - match RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, symbolUse) with - | Some span -> - let textSpan = Tokenizer.fixupSpan(sourceText, span) - yield FSharpInlineRenameLocation(document, textSpan) - | None -> () |] - }) - |> Async.Parallel - |> Async.map Array.concat - - return InlineRenameLocationSet(locations, document.Project.Solution, lexerSymbol.Kind, symbolUse.Symbol) :> IFSharpInlineRenameLocationSet - } |> RoslynHelpers.StartAsyncAsTask(cancellationToken) - - member _.TryOnBeforeGlobalSymbolRenamed(_workspace, _changedDocumentIDs, _replacementText) = true - member _.TryOnAfterGlobalSymbolRenamed(_workspace, _changedDocumentIDs, _replacementText) = true - -[); Shared>] + override _.FindRenameLocationsAsync(_, _, cancellationToken) = + async { + let! symbolUsesByDocumentId = symbolUses + let! locations = + symbolUsesByDocumentId + |> Seq.map (fun (KeyValue(documentId, symbolUses)) -> + async { + let document = document.Project.Solution.GetDocument(documentId) + let! sourceText = document.GetTextAsync(cancellationToken) |> Async.AwaitTask + return + [| for symbolUse in symbolUses do + match RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, symbolUse) with + | Some span -> + let textSpan = Tokenizer.fixupSpan(sourceText, span) + yield FSharpInlineRenameLocation(document, textSpan) + | None -> () |] + }) + |> Async.Parallel + |> Async.map Array.concat + + return InlineRenameLocationSet(locations, document.Project.Solution, lexerSymbol.Kind, symbolUse.Symbol) :> FSharpInlineRenameLocationSet + } |> RoslynHelpers.StartAsyncAsTask(cancellationToken) + +[); Shared>] type internal InlineRenameService [] ( ) = - static member GetInlineRenameInfo(document: Document, position: int) : Async = + inherit FSharpInlineRenameServiceImplementation() + + static member GetInlineRenameInfo(document: Document, position: int) : Async = asyncMaybe { let! ct = Async.CancellationToken |> liftAsync let! sourceText = document.GetTextAsync(ct) @@ -158,13 +149,12 @@ type internal InlineRenameService let! span = RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, symbolUse.Range) let triggerSpan = Tokenizer.fixupSpan(sourceText, span) - return InlineRenameInfo(document, triggerSpan, symbol, symbolUse, declLoc, checkFileResults) :> IFSharpInlineRenameInfo + return InlineRenameInfo(document, triggerSpan, symbol, symbolUse, declLoc, checkFileResults) :> FSharpInlineRenameInfo } - interface IFSharpEditorInlineRenameService with - member _.GetRenameInfoAsync(document: Document, position: int, cancellationToken: CancellationToken) : Task = - asyncMaybe { - return! InlineRenameService.GetInlineRenameInfo(document, position) - } - |> Async.map (Option.defaultValue FailureInlineRenameInfo.Instance) - |> RoslynHelpers.StartAsyncAsTask(cancellationToken) + override _.GetRenameInfoAsync(document: Document, position: int, cancellationToken: CancellationToken) : Task = + asyncMaybe { + return! InlineRenameService.GetInlineRenameInfo(document, position) + } + |> Async.map (Option.defaultValue null) + |> RoslynHelpers.StartAsyncAsTask(cancellationToken) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 1a3f54dbc9beda45c2dcc7912fd23d2804a7313a..777215a3e83b99d0de6f68575662910510f08d21 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -300,7 +300,9 @@ type internal FSharpLanguageService(package : FSharpPackage) = override this.Initialize() = base.Initialize() - this.Workspace.Options <- this.Workspace.Options.WithChangedOption(Shared.Options.FSharpServiceFeatureOnOffOptions.ClosedFileDiagnostic, FSharpConstants.FSharpLanguageName, Nullable false) + let globalOptions = package.ComponentModel.DefaultExportProvider.GetExport().Value + globalOptions.BlockForCompletionItems <- false + globalOptions.SetBackgroundAnalysisScope(openFilesOnly=true) let globalOptions = package.ComponentModel.DefaultExportProvider.GetExport().Value globalOptions.BlockForCompletionItems <- false