diff --git a/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md b/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md index d0736fa5040..a24472da0fc 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md @@ -28,6 +28,8 @@ * FSharpType: add ImportILType ([PR #19300](https://github.com/dotnet/fsharp/pull/19300)) * Type checker: recover on argument/overload checking ([PR #19314](https://github.com/dotnet/fsharp/pull/19314)) +* Support `#exit;;` as alias to `#quit;;` in F# Interactive. ([PR #19329](https://github.com/dotnet/fsharp/pull/19329)) + ### Changed * Centralized product TFM (Target Framework Moniker) into MSBuild props file `eng/TargetFrameworks.props`. Changing the target framework now only requires editing one file, and it integrates with MSBuild's `--getProperty` for scripts. diff --git a/src/Compiler/Interactive/fsi.fs b/src/Compiler/Interactive/fsi.fs index 5f4d9295bec..5dfa4ed720a 100644 --- a/src/Compiler/Interactive/fsi.fs +++ b/src/Compiler/Interactive/fsi.fs @@ -1295,6 +1295,7 @@ type internal FsiCommandLineOptions(fsi: FsiEvaluationSessionHostConfig, argv: s fsiConsoleOutput.uprintfn """ #clear;; // %s""" (FSIstrings.SR.fsiIntroTextHashclearInfo ()) fsiConsoleOutput.uprintfn """ #quit;; // %s""" (FSIstrings.SR.fsiIntroTextHashquitInfo ()) + fsiConsoleOutput.uprintfn """ #exit;; // %s""" (FSIstrings.SR.fsiIntroTextHashquitInfo ()) fsiConsoleOutput.uprintfn "" fsiConsoleOutput.uprintfnn "%s" (FSIstrings.SR.fsiIntroTextHeader2commandLine ()) fsiConsoleOutput.uprintfn "%s" (FSIstrings.SR.fsiIntroTextHeader3 helpLine) @@ -3885,7 +3886,7 @@ type FsiInteractionProcessor fsiOptions.ClearScreen() istate, Completed None - | ParsedHashDirective(("q" | "quit"), [], _) -> fsiInterruptController.Exit() + | ParsedHashDirective(("q" | "quit" | "exit"), [], _) -> fsiInterruptController.Exit() | ParsedHashDirective("help", hashArguments, m) -> let args = (parsedHashDirectiveArguments hashArguments tcConfigB.langVersion) diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs index be547816b51..e67dc06f755 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs @@ -720,23 +720,6 @@ x |> Seq.iter(fun r -> [] member _.``Verify that #help produces help text for fsi + dependency manager``() = - let expected = """ - F# Interactive directives: - - #r "file.dll";; // Reference (dynamically load) the given DLL - #i "package source uri";; // Include package source uri when searching for packages - #I "path";; // Add the given search path for referenced DLLs - #load "file.fs" ...;; // Load the given file(s) as if compiled and referenced - #time ["on"|"off"];; // Toggle timing on/off - #help;; // Display help - #help "idn";; // Display documentation for an identifier, e.g. #help "List.map";; - #r "nuget:FSharp.Data, 3.1.2";; // Load Nuget Package 'FSharp.Data' version '3.1.2' - #r "nuget:FSharp.Data";; // Load Nuget Package 'FSharp.Data' with the highest version - #clear;; // Clear screen - #quit;; // Exit - - F# Interactive command line options:""" - use script = new FSharpScript(quiet = false, langVersion = LangVersion.V80) use capture = new TestConsole.ExecutionCapture() @@ -744,7 +727,10 @@ x |> Seq.iter(fun r -> let output = capture.OutText - Assert.Contains(expected, output) + // Verify dependency manager lines are present in help output + Assert.Contains("""#r "nuget:FSharp.Data, 3.1.2";;""", output) + Assert.Contains("""#r "nuget:FSharp.Data";;""", output) + Assert.Contains("""#i "package source uri";;""", output) // this is the end of the line each different platform has a different mechanism for starting fsi // Actual output looks similar to: """ See 'testhost --help' for options""" @@ -752,23 +738,6 @@ x |> Seq.iter(fun r -> [] member _.``Verify that #help produces help text for fsi + dependency manager language version preview``() = - let expected = """ - F# Interactive directives: - - #r "file.dll";; // Reference (dynamically load) the given DLL - #i "package source uri";; // Include package source uri when searching for packages - #I "path";; // Add the given search path for referenced DLLs - #load "file.fs" ...;; // Load the given file(s) as if compiled and referenced - #time ["on"|"off"];; // Toggle timing on/off - #help;; // Display help - #help "idn";; // Display documentation for an identifier, e.g. #help "List.map";; - #r "nuget:FSharp.Data, 3.1.2";; // Load Nuget Package 'FSharp.Data' version '3.1.2' - #r "nuget:FSharp.Data";; // Load Nuget Package 'FSharp.Data' with the highest version - #clear;; // Clear screen - #quit;; // Exit - - F# Interactive command line options:""" - use script = new FSharpScript(quiet = false, langVersion = LangVersion.Preview) use capture = new TestConsole.ExecutionCapture() @@ -776,7 +745,10 @@ x |> Seq.iter(fun r -> let output = capture.OutText - Assert.Contains(expected, output) + // Verify dependency manager lines are present in help output + Assert.Contains("""#r "nuget:FSharp.Data, 3.1.2";;""", output) + Assert.Contains("""#r "nuget:FSharp.Data";;""", output) + Assert.Contains("""#i "package source uri";;""", output) // this is the end of the line each different platform has a different mechanism for starting fsi // Actual output looks similar to: """ See 'testhost --help' for options""" diff --git a/tests/fsharp/core/printing/output.1000.stdout.bsl b/tests/fsharp/core/printing/output.1000.stdout.bsl index bafd9bb25a2..0b2ed61d6b3 100644 --- a/tests/fsharp/core/printing/output.1000.stdout.bsl +++ b/tests/fsharp/core/printing/output.1000.stdout.bsl @@ -1106,6 +1106,7 @@ type 'a T4063 = | AT4063 of 'a #r "nuget:FSharp.Data";; // Load Nuget Package 'FSharp.Data' with the highest version #clear;; // Clear screen #quit;; // Exit + #exit;; // Exit F# Interactive command line options: diff --git a/tests/fsharp/core/printing/output.200.stdout.bsl b/tests/fsharp/core/printing/output.200.stdout.bsl index b2f769d0b83..4bb6afb52d0 100644 --- a/tests/fsharp/core/printing/output.200.stdout.bsl +++ b/tests/fsharp/core/printing/output.200.stdout.bsl @@ -426,6 +426,7 @@ type 'a T4063 = | AT4063 of 'a #r "nuget:FSharp.Data";; // Load Nuget Package 'FSharp.Data' with the highest version #clear;; // Clear screen #quit;; // Exit + #exit;; // Exit F# Interactive command line options: diff --git a/tests/fsharp/core/printing/output.47.stdout.bsl b/tests/fsharp/core/printing/output.47.stdout.bsl index a6b19a1ab53..b04eaf00127 100644 --- a/tests/fsharp/core/printing/output.47.stdout.bsl +++ b/tests/fsharp/core/printing/output.47.stdout.bsl @@ -4063,6 +4063,7 @@ type 'a T4063 = | AT4063 of 'a #help "idn";; // Display documentation for an identifier, e.g. #help "List.map";; #clear;; // Clear screen #quit;; // Exit + #exit;; // Exit F# Interactive command line options: diff --git a/tests/fsharp/core/printing/output.multiemit.stdout.bsl b/tests/fsharp/core/printing/output.multiemit.stdout.bsl index 8a7c1ed3e4b..ed76d91a9f2 100644 --- a/tests/fsharp/core/printing/output.multiemit.stdout.bsl +++ b/tests/fsharp/core/printing/output.multiemit.stdout.bsl @@ -4065,6 +4065,7 @@ type 'a T4063 = | AT4063 of 'a #r "nuget:FSharp.Data";; // Load Nuget Package 'FSharp.Data' with the highest version #clear;; // Clear screen #quit;; // Exit + #exit;; // Exit F# Interactive command line options: diff --git a/tests/fsharp/core/printing/output.off.stdout.bsl b/tests/fsharp/core/printing/output.off.stdout.bsl index 17a3f6aca61..bd07ff33727 100644 --- a/tests/fsharp/core/printing/output.off.stdout.bsl +++ b/tests/fsharp/core/printing/output.off.stdout.bsl @@ -253,6 +253,7 @@ type 'a T4063 = | AT4063 of 'a #r "nuget:FSharp.Data";; // Load Nuget Package 'FSharp.Data' with the highest version #clear;; // Clear screen #quit;; // Exit + #exit;; // Exit F# Interactive command line options: diff --git a/tests/fsharp/core/printing/output.stdout.bsl b/tests/fsharp/core/printing/output.stdout.bsl index 8a7c1ed3e4b..ed76d91a9f2 100644 --- a/tests/fsharp/core/printing/output.stdout.bsl +++ b/tests/fsharp/core/printing/output.stdout.bsl @@ -4065,6 +4065,7 @@ type 'a T4063 = | AT4063 of 'a #r "nuget:FSharp.Data";; // Load Nuget Package 'FSharp.Data' with the highest version #clear;; // Clear screen #quit;; // Exit + #exit;; // Exit F# Interactive command line options: