diff --git a/.gitignore b/.gitignore index 33c9666c14b..6ca107a5779 100644 --- a/.gitignore +++ b/.gitignore @@ -134,4 +134,6 @@ positive.exe /tests/FSharp.Compiler.ComponentTests/FSharpChecker/StandardOutput.txt # ilverify baseline result files -*.bsl.actual \ No newline at end of file +*.bsl.actual +/src/FSharp.DependencyManager.Nuget/StandardError.txt +/src/FSharp.DependencyManager.Nuget/StandardOutput.txt diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md index 5f722b11a12..b9772f3f5ac 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md @@ -18,6 +18,7 @@ * Miscellanous parentheses analyzer fixes. ([PR #18350](https://github.com/dotnet/fsharp/pull/18350)) * Fix duplicate parse error reporting for GetBackgroundCheckResultsForFileInProject ([Issue #18379](https://github.com/dotnet/fsharp/issues/18379) [PR #18380](https://github.com/dotnet/fsharp/pull/18380)) * Fix MethodDefNotFound when compiling code invoking delegate with option parameter ([Issue #5171](https://github.com/dotnet/fsharp/issues/5171), [PR #18385](https://github.com/dotnet/fsharp/pull/18385)) +* Fix #r nuget ..." downloads unneeded packages ([Issue #18231](https://github.com/dotnet/fsharp/issues/18231), [PR #18393](https://github.com/dotnet/fsharp/pull/18393)) ### Added * Added missing type constraints in FCS. ([PR #18241](https://github.com/dotnet/fsharp/pull/18241)) @@ -30,7 +31,6 @@ ### Changed - * FSharpCheckFileResults.ProjectContext.ProjectOptions will not be available when using the experimental Transparent Compiler feature. ([PR #18205](https://github.com/dotnet/fsharp/pull/18205)) * Update `Obsolete` attribute checking to account for `DiagnosticId` and `UrlFormat` properties. ([PR #18224](https://github.com/dotnet/fsharp/pull/18224)) * Remove `Cancellable.UsingToken` from tests ([PR #18276](https://github.com/dotnet/fsharp/pull/18276)) diff --git a/docs/release-notes/.VisualStudio/17.14.md b/docs/release-notes/.VisualStudio/17.14.md index db5d628bb0c..f9b710ea122 100644 --- a/docs/release-notes/.VisualStudio/17.14.md +++ b/docs/release-notes/.VisualStudio/17.14.md @@ -1,4 +1,5 @@ ### Fixed +* Fix #r nuget ..." downloads unneeded packages ([Issue #18231](https://github.com/dotnet/fsharp/issues/18231), [PR #18393](https://github.com/dotnet/fsharp/pull/18393)) ### Added * Add a switch to determine whether to generate a default implementation body for overridden method when completing. [PR #18341](https://github.com/dotnet/fsharp/pull/18341) diff --git a/src/Compiler/Driver/ScriptClosure.fs b/src/Compiler/Driver/ScriptClosure.fs index 0e22231abb8..e408f2bca28 100644 --- a/src/Compiler/Driver/ScriptClosure.fs +++ b/src/Compiler/Driver/ScriptClosure.fs @@ -45,6 +45,9 @@ type LoadClosure = /// The resolved package references along with the ranges of the #r positions in each file. PackageReferences: (range * string list)[] + /// The raw package manager lines in the script + PackageManagerLines: Map + /// Whether we're decided to use .NET Framework analysis for this script UseDesktopFramework: bool @@ -82,7 +85,8 @@ type CodeContext = module ScriptPreprocessClosure = /// Represents an input to the closure finding process - type ClosureSource = ClosureSource of fileName: string * referenceRange: range * sourceText: ISourceText * parseRequired: bool + type ClosureSource = + | ClosureSource of fileName: string * referenceRange: range * sourceText: ISourceText * Position option * parseRequired: bool /// Represents an output of the closure finding process type ClosureFile = @@ -253,7 +257,7 @@ module ScriptPreprocessClosure = | Some(n: int) -> new StreamReader(stream, Encoding.GetEncoding n) let source = reader.ReadToEnd() - [ ClosureSource(fileName, m, SourceText.ofString source, parseRequired) ] + [ ClosureSource(fileName, m, SourceText.ofString source, None, parseRequired) ] with RecoverableException exn -> errorRecovery exn m [] @@ -313,16 +317,25 @@ module ScriptPreprocessClosure = let packageReferences = Dictionary(HashIdentity.Structural) // Resolve the packages - let rec resolveDependencyManagerSources scriptName = + let rec resolveDependencyManagerSources scriptName (caret: Position option) = + let caretLine = + match caret with + | None -> Int32.MinValue + | Some pos -> pos.Line + + let isEditorCursorInPackageLines (line: PackageManagerLine) = + caretLine >= line.Range.StartLine && caretLine <= line.Range.EndLine + [ if not (loadScripts.Contains scriptName) then for kv in tcConfig.packageManagerLines do let packageManagerKey, packageManagerLines = kv.Key, kv.Value - match packageManagerLines with + match packageManagerLines |> List.filter (not << isEditorCursorInPackageLines) with | [] -> () | packageManagerLine :: _ -> let m = packageManagerLine.Range + let packageManagerLines = packageManagerLines yield! processPackageManagerLines m packageManagerLines scriptName packageManagerKey ] @@ -426,7 +439,7 @@ module ScriptPreprocessClosure = let scriptText = stream.ReadAllText() loadScripts.Add script |> ignore let iSourceText = SourceText.ofString scriptText - yield! processClosureSource (ClosureSource(script, m, iSourceText, true)) + yield! processClosureSource (ClosureSource(script, m, iSourceText, None, true)) else // Send outputs via diagnostics @@ -443,7 +456,7 @@ module ScriptPreprocessClosure = tcConfig <- TcConfig.Create(tcConfigB, validate = false) ] - and processClosureSource (ClosureSource(fileName, m, sourceText, parseRequired)) = + and processClosureSource (ClosureSource(fileName, m, sourceText, caret, parseRequired)) = [ if not (observedSources.HaveSeen(fileName)) then observedSources.SetSeen(fileName) @@ -473,7 +486,7 @@ module ScriptPreprocessClosure = tcConfig <- tcConfigResult // We accumulate the tcConfig in order to collect assembly references - yield! resolveDependencyManagerSources fileName + yield! resolveDependencyManagerSources fileName caret let postSources = tcConfig.GetAvailableLoadedSources() @@ -483,7 +496,7 @@ module ScriptPreprocessClosure = else [] - yield! resolveDependencyManagerSources fileName + yield! resolveDependencyManagerSources fileName caret for m, subFile in sources do if IsScript subFile then @@ -540,7 +553,7 @@ module ScriptPreprocessClosure = | _ -> lastClosureFile /// Reduce the full directive closure into LoadClosure - let GetLoadClosure (rootFilename, closureFiles, tcConfig: TcConfig, codeContext, packageReferences, earlierDiagnostics) = + let GetLoadClosure (rootFilename, closureFiles, tcConfig: TcConfig, codeContext, packageReferences, earlierDiagnostics) : LoadClosure = // Mark the last file as isLastCompiland. let closureFiles = @@ -612,23 +625,21 @@ module ScriptPreprocessClosure = // Filter out non-root errors and warnings let allRootDiagnostics = allRootDiagnostics |> List.filter (fst >> isRootRange) - let result: LoadClosure = - { - SourceFiles = List.groupBy fst sourceFiles |> List.map (map2Of2 (List.map snd)) - References = List.groupBy fst references |> List.map (map2Of2 (List.map snd)) - PackageReferences = packageReferences - UseDesktopFramework = (tcConfig.primaryAssembly = PrimaryAssembly.Mscorlib) - SdkDirOverride = tcConfig.sdkDirOverride - UnresolvedReferences = unresolvedReferences - Inputs = sourceInputs - NoWarns = List.groupBy fst globalNoWarns |> List.map (map2Of2 (List.map snd)) - OriginalLoadReferences = tcConfig.loadedSources - ResolutionDiagnostics = resolutionDiagnostics - AllRootFileDiagnostics = allRootDiagnostics - LoadClosureRootFileDiagnostics = loadClosureRootDiagnostics - } - - result + { + SourceFiles = List.groupBy fst sourceFiles |> List.map (map2Of2 (List.map snd)) + References = List.groupBy fst references |> List.map (map2Of2 (List.map snd)) + PackageReferences = packageReferences + PackageManagerLines = tcConfig.packageManagerLines + UseDesktopFramework = (tcConfig.primaryAssembly = PrimaryAssembly.Mscorlib) + SdkDirOverride = tcConfig.sdkDirOverride + UnresolvedReferences = unresolvedReferences + Inputs = sourceInputs + NoWarns = List.groupBy fst globalNoWarns |> List.map (map2Of2 (List.map snd)) + OriginalLoadReferences = tcConfig.loadedSources + ResolutionDiagnostics = resolutionDiagnostics + AllRootFileDiagnostics = allRootDiagnostics + LoadClosureRootFileDiagnostics = loadClosureRootDiagnostics + } /// Given source text, find the full load closure. Used from service.fs, when editing a script file let GetFullClosureOfScriptText @@ -637,6 +648,7 @@ module ScriptPreprocessClosure = defaultFSharpBinariesDir, fileName, sourceText, + caret, codeContext, useSimpleResolution, useFsiAuxLib, @@ -649,7 +661,6 @@ module ScriptPreprocessClosure = reduceMemoryUsage, dependencyProvider ) = - // Resolve the basic references such as FSharp.Core.dll first, before processing any #I directives in the script // // This is tries to mimic the action of running the script in F# Interactive - the initial context for scripting is created @@ -700,7 +711,7 @@ module ScriptPreprocessClosure = reduceMemoryUsage ) - let closureSources = [ ClosureSource(fileName, range0, sourceText, true) ] + let closureSources = [ ClosureSource(fileName, range0, sourceText, caret, true) ] let closureFiles, tcConfig, packageReferences = FindClosureFiles(fileName, closureSources, tcConfig, codeContext, lexResourceManager, dependencyProvider) @@ -742,6 +753,7 @@ type LoadClosure with defaultFSharpBinariesDir, fileName: string, sourceText: ISourceText, + caret: Position option, implicitDefines, useSimpleResolution: bool, useFsiAuxLib, @@ -762,6 +774,7 @@ type LoadClosure with defaultFSharpBinariesDir, fileName, sourceText, + caret, implicitDefines, useSimpleResolution, useFsiAuxLib, diff --git a/src/Compiler/Driver/ScriptClosure.fsi b/src/Compiler/Driver/ScriptClosure.fsi index 6f764b299a9..249885036cd 100644 --- a/src/Compiler/Driver/ScriptClosure.fsi +++ b/src/Compiler/Driver/ScriptClosure.fsi @@ -42,6 +42,9 @@ type LoadClosure = /// The resolved package references along with the ranges of the #r positions in each file. PackageReferences: (range * string list)[] + /// The raw package manager lines in the script + PackageManagerLines: Map + /// Whether we're decided to use .NET Framework analysis for this script UseDesktopFramework: bool @@ -80,6 +83,7 @@ type LoadClosure = defaultFSharpBinariesDir: string * fileName: string * sourceText: ISourceText * + caret: Position option * implicitDefines: CodeContext * useSimpleResolution: bool * useFsiAuxLib: bool * diff --git a/src/Compiler/Service/BackgroundCompiler.fs b/src/Compiler/Service/BackgroundCompiler.fs index 329fd21c63d..a7254abb4bc 100644 --- a/src/Compiler/Service/BackgroundCompiler.fs +++ b/src/Compiler/Service/BackgroundCompiler.fs @@ -112,6 +112,7 @@ type internal IBackgroundCompiler = abstract member GetProjectOptionsFromScript: fileName: string * sourceText: ISourceText * + caret: Position option * previewEnabled: bool option * loadedTimeStamp: System.DateTime option * otherFlags: string array option * @@ -126,6 +127,7 @@ type internal IBackgroundCompiler = abstract GetProjectSnapshotFromScript: fileName: string * sourceText: ISourceTextNew * + caret: Position option * documentSource: DocumentSource * previewEnabled: bool option * loadedTimeStamp: System.DateTime option * @@ -1308,6 +1310,7 @@ type internal BackgroundCompiler ( fileName, sourceText, + caret, previewEnabled, loadedTimeStamp, otherFlags, @@ -1358,6 +1361,7 @@ type internal BackgroundCompiler FSharpCheckerResultsSettings.defaultFSharpBinariesDir, fileName, sourceText, + caret, CodeContext.Editing, useSimpleResolution, useFsiAuxLib, @@ -1593,6 +1597,7 @@ type internal BackgroundCompiler ( fileName: string, sourceText: ISourceText, + caret: Position option, previewEnabled: bool option, loadedTimeStamp: DateTime option, otherFlags: string array option, @@ -1606,6 +1611,7 @@ type internal BackgroundCompiler self.GetProjectOptionsFromScript( fileName, sourceText, + caret, previewEnabled, loadedTimeStamp, otherFlags, @@ -1621,6 +1627,7 @@ type internal BackgroundCompiler ( fileName: string, sourceText: ISourceTextNew, + caret: Position option, documentSource: DocumentSource, previewEnabled: bool option, loadedTimeStamp: DateTime option, @@ -1637,6 +1644,7 @@ type internal BackgroundCompiler self.GetProjectOptionsFromScript( fileName, sourceText, + caret, previewEnabled, loadedTimeStamp, otherFlags, diff --git a/src/Compiler/Service/BackgroundCompiler.fsi b/src/Compiler/Service/BackgroundCompiler.fsi index d93ece6217b..6192b23e3f9 100644 --- a/src/Compiler/Service/BackgroundCompiler.fsi +++ b/src/Compiler/Service/BackgroundCompiler.fsi @@ -90,6 +90,7 @@ type internal IBackgroundCompiler = abstract GetProjectOptionsFromScript: fileName: string * sourceText: ISourceText * + caret: Position option * previewEnabled: bool option * loadedTimeStamp: System.DateTime option * otherFlags: string array option * @@ -104,6 +105,7 @@ type internal IBackgroundCompiler = abstract GetProjectSnapshotFromScript: fileName: string * sourceText: ISourceTextNew * + caret: Position option * documentSource: DocumentSource * previewEnabled: bool option * loadedTimeStamp: System.DateTime option * diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 8cb27875075..8092f895e23 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -4006,6 +4006,7 @@ type FsiInteractiveChecker(legacyReferenceResolver, tcConfig: TcConfig, tcGlobal defaultFSharpBinariesDir, fileName, sourceText, + None, CodeContext.Editing, tcConfig.useSimpleResolution, tcConfig.useFsiAuxLib, diff --git a/src/Compiler/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs index 3b411028328..47cfff13e09 100644 --- a/src/Compiler/Service/TransparentCompiler.fs +++ b/src/Compiler/Service/TransparentCompiler.fs @@ -496,6 +496,7 @@ type internal TransparentCompiler defaultFSharpBinariesDir, fileName, source, + None, CodeContext.Editing, useSimpleResolution, useFsiAuxLib, @@ -2342,6 +2343,7 @@ type internal TransparentCompiler ( fileName: string, sourceText: ISourceText, + caret: Position option, previewEnabled: bool option, loadedTimeStamp: DateTime option, otherFlags: string array option, @@ -2359,6 +2361,7 @@ type internal TransparentCompiler bc.GetProjectSnapshotFromScript( fileName, SourceTextNew.ofISourceText sourceText, + caret, DocumentSource.FileSystem, previewEnabled, loadedTimeStamp, @@ -2379,6 +2382,7 @@ type internal TransparentCompiler ( fileName: string, sourceText: ISourceTextNew, + caret: Position option, documentSource: DocumentSource, previewEnabled: bool option, loadedTimeStamp: DateTime option, diff --git a/src/Compiler/Service/service.fs b/src/Compiler/Service/service.fs index 4835b784bf8..3a3c56dfe2f 100644 --- a/src/Compiler/Service/service.fs +++ b/src/Compiler/Service/service.fs @@ -509,6 +509,7 @@ type FSharpChecker ( fileName, source, + ?caret, ?previewEnabled, ?loadedTimeStamp, ?otherFlags, @@ -524,6 +525,7 @@ type FSharpChecker backgroundCompiler.GetProjectOptionsFromScript( fileName, source, + caret, previewEnabled, loadedTimeStamp, otherFlags, @@ -540,6 +542,7 @@ type FSharpChecker ( fileName, source, + ?caret, ?documentSource, ?previewEnabled, ?loadedTimeStamp, @@ -557,6 +560,7 @@ type FSharpChecker backgroundCompiler.GetProjectSnapshotFromScript( fileName, source, + caret, documentSource, previewEnabled, loadedTimeStamp, diff --git a/src/Compiler/Service/service.fsi b/src/Compiler/Service/service.fsi index 58c4a8c1dfb..69ae46b16b5 100644 --- a/src/Compiler/Service/service.fsi +++ b/src/Compiler/Service/service.fsi @@ -226,6 +226,7 @@ type public FSharpChecker = /// /// Used to differentiate between scripts, to consider each script a separate project. Also used in formatted error messages. /// The source for the file. + /// The editor location for the cursor if available. /// Is the preview compiler enabled. /// Indicates when the script was loaded into the editing environment, /// so that an 'unload' and 'reload' action will cause the script to be considered as a new project, @@ -240,6 +241,7 @@ type public FSharpChecker = member GetProjectOptionsFromScript: fileName: string * source: ISourceText * + ?caret: Position * ?previewEnabled: bool * ?loadedTimeStamp: DateTime * ?otherFlags: string[] * @@ -253,6 +255,7 @@ type public FSharpChecker = /// Used to differentiate between scripts, to consider each script a separate project. Also used in formatted error messages. /// The source for the file. + /// The editor location for the cursor if available. /// DocumentSource to load any additional files. /// Is the preview compiler enabled. /// Indicates when the script was loaded into the editing environment, @@ -269,6 +272,7 @@ type public FSharpChecker = member GetProjectSnapshotFromScript: fileName: string * source: ISourceTextNew * + ?caret: Position * ?documentSource: DocumentSource * ?previewEnabled: bool * ?loadedTimeStamp: DateTime * diff --git a/src/FSharp.DependencyManager.Nuget/FSDependencyManager.txt b/src/FSharp.DependencyManager.Nuget/FSDependencyManager.txt index e70d2691151..6eb22c00f7a 100644 --- a/src/FSharp.DependencyManager.Nuget/FSDependencyManager.txt +++ b/src/FSharp.DependencyManager.Nuget/FSDependencyManager.txt @@ -9,4 +9,5 @@ highestVersion,"with the highest version" sourceDirectoryDoesntExist,"The source directory '%s' not found" timedoutResolvingPackages,"Timed out resolving packages, process: '%s' '%s'" invalidTimeoutValue,"Invalid value for timeout '%s', valid values: none, -1 and integer milliseconds to wait" -missingTimeoutValue,"Missing value for timeout" \ No newline at end of file +missingTimeoutValue,"Missing value for timeout" +invalidBooleanValue,"Invalid value for boolean '%s', valid values: true or false" \ No newline at end of file diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs index 553c97dc60f..f25d31a1ba7 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs @@ -11,6 +11,7 @@ type PackageReference = Version: string RestoreSources: string Script: string + UsePackageTargets: bool } module internal ProjectFile = diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs index fe0433f71cf..0ea46abaf54 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs @@ -55,16 +55,30 @@ module FSharpDependencyManager = Version = ver RestoreSources = src Script = script + UsePackageTargets = usePackageTargets } = p + let usePackageTargets = + match usePackageTargets with + | false -> "ExcludeAssets='build;buildTransitive;buildMultitargeting'" + | true -> "" + seq { match not (String.IsNullOrEmpty(inc)), not (String.IsNullOrEmpty(ver)), not (String.IsNullOrEmpty(script)) with - | true, true, false -> yield sprintf @" " inc ver + | true, true, false -> + yield sprintf @" " inc ver usePackageTargets | true, true, true -> - yield sprintf @" " inc ver script - | true, false, false -> yield sprintf @" " inc - | true, false, true -> yield sprintf @" " inc script + yield + sprintf + @" " + inc + ver + script + usePackageTargets + | true, false, false -> yield sprintf @" " inc usePackageTargets + | true, false, true -> + yield sprintf @" " inc script usePackageTargets | _ -> () match not (String.IsNullOrEmpty(src)) with @@ -96,6 +110,7 @@ module FSharpDependencyManager = Version = "*" RestoreSources = "" Script = "" + UsePackageTargets = false } match options with @@ -114,11 +129,20 @@ module FSharpDependencyManager = let setVersion v = Some { current with Version = v } + let setUsePackageTargets v = + Some { current with UsePackageTargets = v } + match opt with | Some "include", Some v -> addInclude v |> parsePackageReferenceOption' rest implicitArgumentCount | Some "include", None -> raise (ArgumentException(SR.requiresAValue ("Include"))) | Some "version", Some v -> setVersion v |> parsePackageReferenceOption' rest implicitArgumentCount | Some "version", None -> setVersion "*" |> parsePackageReferenceOption' rest implicitArgumentCount + | Some "usepackagetargets", v -> + match v with + | Some v when v.ToLowerInvariant() = "true" -> setUsePackageTargets true + | Some v when v.ToLowerInvariant() = "false" -> setUsePackageTargets false + | _ -> raise (ArgumentException(SR.invalidBooleanValue ("usepackagetargets"))) + |> parsePackageReferenceOption' rest implicitArgumentCount | Some "restoresources", Some v -> Some { current with @@ -212,12 +236,12 @@ module FSharpDependencyManager = let referencesHaveWildCardVersion = // Verify to see if the developer specified a wildcard version. If they did then caching is not possible let hasWildCardVersion p = - // Todo: named record please let { Include = package Version = ver RestoreSources = _ Script = _ + UsePackageTargets = _ } = p diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf index 800c2e40248..1df52699df6 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf @@ -12,6 +12,11 @@ s nejvyšší verzí + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Neplatná hodnota pro časový limit {0}. Platné hodnoty: none, -1 a celočíselný počet milisekund, po které se má počkat diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf index f3762130515..bb2ec8665b4 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf @@ -12,6 +12,11 @@ mit der höchsten Version + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Ungültiger Wert für Timeout "{0}", gültige Werte: keine, -1 und ganzzahlige Millisekundenwerte für die Wartezeit diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf index 2851c230dab..e9ee6650268 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf @@ -12,6 +12,11 @@ con la última versión + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Valor de tiempo de espera "{0}" no válido. Valores válidos: ninguno, -1 y un número entero de milisegundos de espera diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf index 8ab1dccc35f..60c4bb10953 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf @@ -12,6 +12,11 @@ avec la version la plus récente + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Valeur non valide pour le délai d'expiration : '{0}'. Valeurs valides : aucune valeur, -1 ou un nombre entier pour le délai d'attente en millisecondes diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf index c605c4af3ba..260e4879994 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf @@ -12,6 +12,11 @@ con la versione massima + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Valore non valido per il timeout '{0}'. I valori validi sono: nessuno, -1 e numeri interi per i millisecondi di attesa diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf index 2e19d06a10f..63bb78e5411 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf @@ -12,6 +12,11 @@ 最新バージョン + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait タイムアウト '{0}' の値が無効です。有効な値: なし、-1、および整数 (待機するミリ秒) diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf index 01d252b6243..2390149fd84 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf @@ -12,6 +12,11 @@ 최상위 버전으로 + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait 시간 제한 '{0}'의 값이 잘못되었습니다. 유효한 값: 없음, -1 및 정수 대기 시간(밀리초) diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf index 4ae0d2e448e..19b971eb1eb 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf @@ -12,6 +12,11 @@ z najwyższą wersją + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Nieprawidłowa wartość limitu czasu „{0}”; prawidłowe wartości: none, -1 i liczba całkowita określająca liczbę milisekund oczekiwania diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pt-BR.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pt-BR.xlf index 7e8409fd8d7..fe73e35d112 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pt-BR.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pt-BR.xlf @@ -12,6 +12,11 @@ com a versão mais recente + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Valor inválido para o tempo limite '{0}'. Valores válidos: none,-1 e milissegundos inteiros de espera diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf index dafbfb8243d..c7f602855d5 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf @@ -12,6 +12,11 @@ с наивысшей версией + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Недопустимое значение времени ожидания "{0}". Допустимые значения: none, –1 и integer, мс ожидания. diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf index 312793af714..585ac4950e4 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf @@ -12,6 +12,11 @@ en yüksek sürümle + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Zaman aşımı için '{0}' değeri geçersiz, geçerli değerler: none, -1 ve tamsayı milisaniye cinsinden bekleme süresi diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hans.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hans.xlf index 7e04d921b0a..2192ad1c9df 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hans.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hans.xlf @@ -12,6 +12,11 @@ 具有最高版本 + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait 超时 "{0}" 的值无效,有效值: none、-1 和要等待的毫秒数(整数) diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hant.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hant.xlf index d82293b0cf2..f7911a29659 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hant.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hant.xlf @@ -12,6 +12,11 @@ 具有最高版本 + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait 逾時 '{0}' 值無效,有效的值: 無、-1 和要等候的整數毫秒 diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs index d085005d9ac..ecf5b81d97b 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs @@ -513,3 +513,21 @@ let add (col:IServiceCollection) = let _value,diag = script.Eval(code) Assert.Empty(diag) + [] + [] + [] + [] + [] + member _.``Eval script with usepackagetargets options``(code, shouldSucceed, error) = + use script = new FSharpScript() + let result, errors = script.Eval(code) + match shouldSucceed with + | true -> + Assert.Empty(errors) + match result with + | Ok(_) -> () + | Error(ex) -> Assert.True(false, "expected no failures") + | false -> + Assert.NotEmpty(errors) + Assert.Equal(1, errors.Length) + Assert.Equal(error, errors.[0].ToString()) diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index 1836a6673c1..f89f7a406be 100755 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -2066,7 +2066,7 @@ FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.CodeAnalysi FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.CodeAnalysis.FSharpSymbolUse[] GetUsesOfSymbolInFile(FSharp.Compiler.Symbols.FSharpSymbol, Microsoft.FSharp.Core.FSharpOption`1[System.Threading.CancellationToken]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Diagnostics.FSharpDiagnostic[] Diagnostics FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Diagnostics.FSharpDiagnostic[] get_Diagnostics() -FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.DeclarationListInfo GetDeclarationListInfo(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]], Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Text.Position,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.EditorServices.CompletionContext]]]) +FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.DeclarationListInfo GetDeclarationListInfo(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]], Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Text.Position,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.EditorServices.CompletionContext]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.FindDeclResult GetDeclarationLocation(Int32, Int32, System.String, Microsoft.FSharp.Collections.FSharpList`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.MethodGroup GetMethods(Int32, Int32, System.String, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.String]]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.SemanticClassificationItem[] GetSemanticClassification(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) @@ -2079,7 +2079,7 @@ FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Symbols.FSh FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Symbols.FSharpOpenDeclaration[] get_OpenDeclarations() FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Text.Range[] GetFormatSpecifierLocations() FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse] GetSymbolUsesAtLocation(Int32, Int32, System.String, Microsoft.FSharp.Collections.FSharpList`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse]] GetDeclarationListSymbols(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]]) +FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse]] GetDeclarationListSymbols(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse] GetSymbolUseAtLocation(Int32, Int32, System.String, Microsoft.FSharp.Collections.FSharpList`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpDisplayContext] GetDisplayContextForPos(FSharp.Compiler.Text.Position) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpImplementationFileContents] ImplementationFile @@ -2136,8 +2136,8 @@ FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileAnswer]] ParseAndCheckFileInProject(System.String, FSharpProjectSnapshot, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileAnswer]] ParseAndCheckFileInProject(System.String, Int32, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults]] GetBackgroundCheckResultsForFileInProject(System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpProjectOptions,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectOptionsFromScript(System.String, FSharp.Compiler.Text.ISourceText, Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpProjectSnapshot,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectSnapshotFromScript(System.String, FSharp.Compiler.Text.ISourceTextNew, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpProjectOptions,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectOptionsFromScript(System.String, FSharp.Compiler.Text.ISourceText, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpProjectSnapshot,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectSnapshotFromScript(System.String, FSharp.Compiler.Text.ISourceTextNew, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Diagnostics.FSharpDiagnostic[],Microsoft.FSharp.Core.FSharpOption`1[System.Exception]]] Compile(System.String[], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpParsingOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) @@ -2830,12 +2830,20 @@ FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 GetHashCod FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 Tag FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 get_Tag() FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: System.String ToString() +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData: FSharp.Compiler.Symbols.FSharpType ActualType FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData: FSharp.Compiler.Symbols.FSharpType get_ActualType() FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField ImplementationField FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField SignatureField FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField get_ImplementationField() FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField get_SignatureField() +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: DiagnosticContextInfo ContextInfo FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: DiagnosticContextInfo get_ContextInfo() FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpDisplayContext DisplayContext @@ -2851,21 +2859,13 @@ FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+DefinitionsInSigAndImplNotCompatibleAbbreviationsDifferExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+IFSharpDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() -FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnostic Create(FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity, System.String, Int32, FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity Severity FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity get_Severity() @@ -3047,7 +3047,9 @@ FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext get_ctx() FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler.Text.Range enclosingTypeNameRange FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler.Text.Range get_enclosingTypeNameRange() +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 get_spacesBeforeEnclosingDefinition() FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 get_spacesBeforeOverrideKeyword() +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 spacesBeforeEnclosingDefinition FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 spacesBeforeOverrideKeyword FSharp.Compiler.EditorServices.CompletionContext+OpenDeclaration: Boolean get_isOpenType() FSharp.Compiler.EditorServices.CompletionContext+OpenDeclaration: Boolean isOpenType @@ -3102,7 +3104,7 @@ FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsUnionCaseFieldsD FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext AttributeApplication FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext Invalid FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewInherit(FSharp.Compiler.EditorServices.InheritanceContext, System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[System.String],Microsoft.FSharp.Core.FSharpOption`1[System.String]]) -FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewMethodOverride(FSharp.Compiler.EditorServices.MethodOverrideCompletionContext, FSharp.Compiler.Text.Range, Int32, Boolean, Boolean) +FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewMethodOverride(FSharp.Compiler.EditorServices.MethodOverrideCompletionContext, FSharp.Compiler.Text.Range, Int32, Boolean, Boolean, Int32) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewOpenDeclaration(Boolean) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewParameterList(FSharp.Compiler.Text.Position, System.Collections.Generic.HashSet`1[System.String]) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewPattern(FSharp.Compiler.EditorServices.PatternContext) diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index 8e92f93f0e1..f89f7a406be 100755 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -2136,8 +2136,8 @@ FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileAnswer]] ParseAndCheckFileInProject(System.String, FSharpProjectSnapshot, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileAnswer]] ParseAndCheckFileInProject(System.String, Int32, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults]] GetBackgroundCheckResultsForFileInProject(System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpProjectOptions,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectOptionsFromScript(System.String, FSharp.Compiler.Text.ISourceText, Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpProjectSnapshot,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectSnapshotFromScript(System.String, FSharp.Compiler.Text.ISourceTextNew, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpProjectOptions,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectOptionsFromScript(System.String, FSharp.Compiler.Text.ISourceText, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpProjectSnapshot,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectSnapshotFromScript(System.String, FSharp.Compiler.Text.ISourceTextNew, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Diagnostics.FSharpDiagnostic[],Microsoft.FSharp.Core.FSharpOption`1[System.Exception]]] Compile(System.String[], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpParsingOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) diff --git a/tests/fsharp/core/printing/output.1000.stdout.bsl b/tests/fsharp/core/printing/output.1000.stdout.bsl index 1d5c0fcbae2..e2f3a8d57c8 100644 --- a/tests/fsharp/core/printing/output.1000.stdout.bsl +++ b/tests/fsharp/core/printing/output.1000.stdout.bsl @@ -2787,7 +2787,7 @@ val ShortName: string = "hi" > val list2: int list = [1] module FSI_0319. - A8a951db8294f99e95ae1d276a7ddaefd93d1548e6bf749bdeae55d2649682b3 + Ee54a783c1b4e3fe8e3c42c5a10c384669fed24c7ffbdacfc9698816f925f337 {"ImmutableField0":6} type R1 = diff --git a/tests/fsharp/core/printing/output.200.stdout.bsl b/tests/fsharp/core/printing/output.200.stdout.bsl index 52926a6c17a..a707919336b 100644 --- a/tests/fsharp/core/printing/output.200.stdout.bsl +++ b/tests/fsharp/core/printing/output.200.stdout.bsl @@ -2032,7 +2032,7 @@ val ShortName: string = "hi" > val list2: int list = [1] module FSI_0319. - A8a951db8294f99e95ae1d276a7ddaefd93d1548e6bf749bdeae55d2649682b3 + Ee54a783c1b4e3fe8e3c42c5a10c384669fed24c7ffbdacfc9698816f925f337 {"ImmutableField0":6} type R1 = diff --git a/tests/fsharp/core/printing/output.multiemit.stdout.bsl b/tests/fsharp/core/printing/output.multiemit.stdout.bsl index 2933f92f8b5..9cdf63bcc36 100644 --- a/tests/fsharp/core/printing/output.multiemit.stdout.bsl +++ b/tests/fsharp/core/printing/output.multiemit.stdout.bsl @@ -6334,7 +6334,7 @@ val ShortName: string = "hi" > val list2: int list = [1] module FSI_0318. - A8a951db8294f99e95ae1d276a7ddaefd93d1548e6bf749bdeae55d2649682b3 + Ee54a783c1b4e3fe8e3c42c5a10c384669fed24c7ffbdacfc9698816f925f337 {"ImmutableField0":6} type R1 = diff --git a/tests/fsharp/core/printing/output.off.stdout.bsl b/tests/fsharp/core/printing/output.off.stdout.bsl index 66ff18c8fb9..5806de4d312 100644 --- a/tests/fsharp/core/printing/output.off.stdout.bsl +++ b/tests/fsharp/core/printing/output.off.stdout.bsl @@ -1801,7 +1801,7 @@ val ShortName: string = "hi" > val list2: int list module FSI_0319. - A8a951db8294f99e95ae1d276a7ddaefd93d1548e6bf749bdeae55d2649682b3 + Ee54a783c1b4e3fe8e3c42c5a10c384669fed24c7ffbdacfc9698816f925f337 {"ImmutableField0":6} type R1 = diff --git a/tests/fsharp/core/printing/output.stdout.bsl b/tests/fsharp/core/printing/output.stdout.bsl index 2933f92f8b5..9cdf63bcc36 100644 --- a/tests/fsharp/core/printing/output.stdout.bsl +++ b/tests/fsharp/core/printing/output.stdout.bsl @@ -6334,7 +6334,7 @@ val ShortName: string = "hi" > val list2: int list = [1] module FSI_0318. - A8a951db8294f99e95ae1d276a7ddaefd93d1548e6bf749bdeae55d2649682b3 + Ee54a783c1b4e3fe8e3c42c5a10c384669fed24c7ffbdacfc9698816f925f337 {"ImmutableField0":6} type R1 = diff --git a/vsintegration/src/FSharp.Editor/Common/Extensions.fs b/vsintegration/src/FSharp.Editor/Common/Extensions.fs index 5b154deab73..bca5173b91b 100644 --- a/vsintegration/src/FSharp.Editor/Common/Extensions.fs +++ b/vsintegration/src/FSharp.Editor/Common/Extensions.fs @@ -7,9 +7,15 @@ open System open System.IO open System.Collections.Immutable open System.Collections.Generic +open System.Runtime.InteropServices open System.Threading open System.Threading.Tasks +open Microsoft.VisualStudio +open Microsoft.VisualStudio.Shell +open Microsoft.VisualStudio.Shell.Interop +open Microsoft.VisualStudio.TextManager.Interop + open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.Host @@ -19,6 +25,10 @@ open FSharp.Compiler.Syntax open FSharp.Compiler.Text open Microsoft.VisualStudio.FSharp.Editor +open Microsoft.VisualStudio.Editor +open Microsoft.VisualStudio.Text.Editor +open Microsoft.VisualStudio +open Microsoft.VisualStudio.OLE.Interop type private FSharpGlyph = FSharp.Compiler.EditorServices.FSharpGlyph type private FSharpRoslynGlyph = Microsoft.CodeAnalysis.ExternalAccess.FSharp.FSharpGlyph @@ -59,6 +69,62 @@ type Project with member this.IsFSharp = this.Language = LanguageNames.FSharp +type TextViewEventsHandler + ( + onChangeCaretHandler: (IVsTextView * int * int -> unit) option, + onKillFocus: (IVsTextView -> unit) option, + onSetFocus: (IVsTextView -> unit) option + ) = + interface IVsTextViewEvents with + member this.OnChangeCaretLine(view: IVsTextView, newline: int, oldline: int) = + onChangeCaretHandler + |> Option.iter (fun handler -> handler (view, newline, oldline)) + + member this.OnChangeScrollInfo + ( + _view: IVsTextView, + _iBar: int, + _iMinUnit: int, + _iMaxUnits: int, + _iVisibleUnits: int, + _iFirstVisibleUnit: int + ) = + () + + member this.OnKillFocus(view: IVsTextView) = + onKillFocus |> Option.iter (fun handler -> handler (view)) + + member this.OnSetBuffer(_view: IVsTextView, _buffer: IVsTextLines) = () + + member this.OnSetFocus(view: IVsTextView) = + onSetFocus |> Option.iter (fun handler -> handler (view)) + +type ConnectionPointSubscription = System.IDisposable option + +// Usage example: +// If a handler is None, to not handle that event +// let subscription = subscribeToTextViewEvents (textView, onChangeCaretHandler, onKillFocus, OnSetFocus) +// Unsubscribe using subscription.Dispose() +let subscribeToTextViewEvents (textView: IVsTextView, onChangeCaretHandler, onKillFocus, OnSetFocus) : ConnectionPointSubscription = + let handler = TextViewEventsHandler(onChangeCaretHandler, onKillFocus, OnSetFocus) + + match textView with + | :? IConnectionPointContainer as cpContainer -> + let riid = typeof.GUID + let mutable cookie = 0u + + match cpContainer.FindConnectionPoint(ref riid) with + | null -> None + | cp -> + Some( + cp.Advise(handler, &cookie) + + { new IDisposable with + member _.Dispose() = cp.Unadvise(cookie) + } + ) + | _ -> None + type Document with member this.TryGetLanguageService<'T when 'T :> ILanguageService>() = @@ -69,6 +135,32 @@ type Document with | null -> None | languageServices -> languageServices.GetService<'T>() |> Some + member this.TryGetIVsTextView() : IVsTextView option = + match ServiceProvider.GlobalProvider.GetService(typeof) with + | :? IVsTextManager as textManager -> + // Grab IVsRunningDocumentTable + match ServiceProvider.GlobalProvider.GetService(typeof) with + | :? IVsRunningDocumentTable as rdt -> + match rdt.FindAndLockDocument(uint32 _VSRDTFLAGS.RDT_NoLock, this.FilePath) with + | hr, _, _, docData, _ when ErrorHandler.Succeeded(hr) && docData <> IntPtr.Zero -> + match Marshal.GetObjectForIUnknown docData with + | :? IVsTextBuffer as ivsTextBuffer -> + match textManager.GetActiveView(1, ivsTextBuffer) with + | hr, vsTextView when ErrorHandler.Succeeded(hr) -> Some vsTextView + | _ -> None + | _ -> None + | _ -> None + | _ -> None + | _ -> None + + member this.TryGetTextViewAndCaretPos() : (IVsTextView * Position) option = + match this.TryGetIVsTextView() with + | Some textView -> + match textView.GetCaretPos() with + | hr, line, column when ErrorHandler.Succeeded(hr) -> Some(textView, Position.fromZ line column) + | _ -> None + | None -> None + member this.IsFSharpScript = isScriptFile this.FilePath member this.IsFSharpSignatureFile = isSignatureFile this.FilePath diff --git a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs index c51db3021cf..edf31e68a57 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs @@ -16,6 +16,13 @@ open System.Threading open Microsoft.VisualStudio.FSharp.Interactive.Session open System.Runtime.CompilerServices open CancellableTasks +open Microsoft.VisualStudio.FSharp.Editor.Extensions +open System.Windows +open Microsoft.VisualStudio +open FSharp.Compiler.Text +open Microsoft.VisualStudio.TextManager.Interop + +#nowarn "57" [] module private FSharpProjectOptionsHelpers = @@ -118,7 +125,7 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = ConcurrentDictionary() let singleFileCache = - ConcurrentDictionary() + ConcurrentDictionary() // This is used to not constantly emit the same compilation. let weakPEReferences = ConditionalWeakTable() @@ -198,15 +205,29 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = | false, _ -> let! sourceText = document.GetTextAsync(ct) - let! scriptProjectOptions, _ = - checker.GetProjectOptionsFromScript( - document.FilePath, - sourceText.ToFSharpSourceText(), - previewEnabled = SessionsProperties.fsiPreview, - assumeDotNetFramework = not SessionsProperties.fsiUseNetCore, - userOpName = userOpName - ) + let getProjectOptionsFromScript textViewAndCaret = + match textViewAndCaret with + | None -> + checker.GetProjectOptionsFromScript( + document.FilePath, + sourceText.ToFSharpSourceText(), + previewEnabled = SessionsProperties.fsiPreview, + assumeDotNetFramework = not SessionsProperties.fsiUseNetCore, + userOpName = userOpName + ) + + | Some(_, caret) -> + checker.GetProjectOptionsFromScript( + document.FilePath, + sourceText.ToFSharpSourceText(), + caret, + previewEnabled = SessionsProperties.fsiPreview, + assumeDotNetFramework = not SessionsProperties.fsiUseNetCore, + userOpName = userOpName + ) + let textViewAndCaret = document.TryGetTextViewAndCaretPos() + let! scriptProjectOptions, _ = getProjectOptionsFromScript textViewAndCaret let project = document.Project let otherOptions = @@ -243,13 +264,46 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = let parsingOptions, _ = checker.GetParsingOptionsFromProjectOptions(projectOptions) - singleFileCache.[document.Id] <- (document.Project, fileStamp, parsingOptions, projectOptions) + let updateProjectOptions () = + async { + let! scriptProjectOptions, _ = getProjectOptionsFromScript None + + checker.NotifyFileChanged(document.FilePath, scriptProjectOptions) + |> Async.Start + } + |> Async.Start + + let onChangeCaretHandler (_, _newline: int, _oldline: int) = updateProjectOptions () + let onKillFocus (_) = updateProjectOptions () + let onSetFocus (_) = updateProjectOptions () + + let addToCacheAndSubscribe value = + match value with + | projectId, fileStamp, parsingOptions, projectOptions, _ -> + let subscription = + match textViewAndCaret with + | Some(textView, _) -> + subscribeToTextViewEvents (textView, (Some onChangeCaretHandler), (Some onKillFocus), (Some onSetFocus)) + | None -> None + + (projectId, fileStamp, parsingOptions, projectOptions, subscription) + + singleFileCache.AddOrUpdate( + document.Id, // The key to the cache + (fun _ value -> addToCacheAndSubscribe value), // Function to add the cached value if the key does not exist + (fun _ _ value -> value), // Function to update the value if the key exists + (document.Project, fileStamp, parsingOptions, projectOptions, None) // The value to add or update + ) + |> ignore return ValueSome(parsingOptions, projectOptions) - | true, (oldProject, oldFileStamp, parsingOptions, projectOptions) -> + | true, (oldProject, oldFileStamp, parsingOptions, projectOptions, _) -> if fileStamp <> oldFileStamp || isProjectInvalidated document.Project oldProject ct then - singleFileCache.TryRemove(document.Id) |> ignore + match singleFileCache.TryRemove(document.Id) with + | true, (_, _, _, _, Some subscription) -> subscription.Dispose() + | _ -> () + return! tryComputeOptionsBySingleScriptOrFile document userOpName else return ValueSome(parsingOptions, projectOptions) @@ -460,9 +514,10 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = legacyProjectSites.TryRemove(projectId) |> ignore | FSharpProjectOptionsMessage.ClearSingleFileOptionsCache(documentId) -> match singleFileCache.TryRemove(documentId) with - | true, (_, _, _, projectOptions) -> + | true, (_, _, _, projectOptions, subscription) -> lastSuccessfulCompilations.TryRemove(documentId.ProjectId) |> ignore checker.ClearCache([ projectOptions ]) + subscription |> Option.iter (fun handler -> handler.Dispose()) | _ -> () } diff --git a/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs b/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs index 4f6a3922118..c92e4e99586 100644 --- a/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs +++ b/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs @@ -98,7 +98,7 @@ type internal FSharpLanguageServiceBackgroundRequests_DEPRECATED lazy // This portion is executed on the language service thread let timestamp = if source=null then System.DateTime(2000,1,1) else source.OpenedTime // source is null in unit tests let checker = getInteractiveChecker() - let checkOptions, _diagnostics = checker.GetProjectOptionsFromScript(fileName, FSharp.Compiler.Text.SourceText.ofString sourceText, SessionsProperties.fsiPreview, timestamp, [| |]) |> Async.RunImmediate + let checkOptions, _diagnostics = checker.GetProjectOptionsFromScript(fileName, FSharp.Compiler.Text.SourceText.ofString sourceText, previewEnabled=SessionsProperties.fsiPreview, loadedTimeStamp=timestamp, otherFlags=[| |]) |> Async.RunImmediate let referencedProjectFileNames = [| |] let projectSite = ProjectSitesAndFiles.CreateProjectSiteForScript(fileName, referencedProjectFileNames, checkOptions) { ProjectSite = projectSite diff --git a/vsintegration/tests/Salsa/salsa.fs b/vsintegration/tests/Salsa/salsa.fs index 6ac626f9fcb..1730bd7ec93 100644 --- a/vsintegration/tests/Salsa/salsa.fs +++ b/vsintegration/tests/Salsa/salsa.fs @@ -1110,7 +1110,7 @@ module internal Salsa = member file.GetFileName() = fileName member file.GetProjectOptionsOfScript() = - project.Solution.Vs.LanguageService.FSharpChecker.GetProjectOptionsFromScript(fileName, FSharp.Compiler.Text.SourceText.ofString file.CombinedLines, false, System.DateTime(2000,1,1), [| |]) + project.Solution.Vs.LanguageService.FSharpChecker.GetProjectOptionsFromScript(fileName, FSharp.Compiler.Text.SourceText.ofString file.CombinedLines, previewEnabled=false, loadedTimeStamp=System.DateTime(2000,1,1), otherFlags=[| |]) |> Async.RunImmediate |> fst // drop diagnostics