Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/release-notes/.FSharp.Compiler.Service/11.0.100.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Fixed


### Added

* Added warning FS3884 when a function or delegate value is used as an interpolated string argument. ([PR #19289](https://github.com/dotnet/fsharp/pull/19289))
* Add `#version;;` directive to F# Interactive to display version and environment information. ([Issue #13307](https://github.com/dotnet/fsharp/issues/13307), [PR #19332](https://github.com/dotnet/fsharp/pull/19332))
1 change: 1 addition & 0 deletions src/Compiler/Interactive/FSIstrings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ fsiIntroTextHashhelpInfo,"Display help"
fsiIntroTextHashhelpdocInfo,"Display documentation for an identifier, e.g. #help \"List.map\";;"
fsiIntroTextHashquitInfo,"Exit"
fsiIntroTextHashclearInfo,"Clear screen"
fsiIntroTextHashversionInfo,"Display F# Interactive version and environment information"
fsiIntroTextHeader2commandLine," F# Interactive command line options:"
fsiIntroTextHeader3," See '%s' for options"
fsiLoadingFilesPrefixText,"Loading"
Expand Down
24 changes: 24 additions & 0 deletions src/Compiler/Interactive/fsi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,21 @@ type internal FsiCommandLineOptions(fsi: FsiEvaluationSessionHostConfig, argv: s
fsiConsoleOutput.uprintfnn "%s" (FSComp.SR.optsCopyright ())
fsiConsoleOutput.uprintfn "%s" (FSIstrings.SR.fsiBanner3 ())

member _.ShowVersion() =
fsiConsoleOutput.uprintnfn "%s" tcConfigB.productNameForBannerText
fsiConsoleOutput.uprintnfn "Language Version: %s" tcConfigB.langVersion.SpecifiedVersionString

let fsharpCoreVersion = typeof<unit>.Assembly.GetName().Version |> string

fsiConsoleOutput.uprintnfn "FSharp.Core: %s" fsharpCoreVersion

fsiConsoleOutput.uprintnfn ".NET: %s" System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription

fsiConsoleOutput.uprintnfn
"OS: %s (%O)"
System.Runtime.InteropServices.RuntimeInformation.OSDescription
System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture

member _.ShowHelp(m) =
let helpLine = sprintf "%s --help" executableFileNameWithoutExtension.Value

Expand Down Expand Up @@ -1294,6 +1309,11 @@ type internal FsiCommandLineOptions(fsi: FsiEvaluationSessionHostConfig, argv: s
fsiConsoleOutput.uprintfn "%s" msg

fsiConsoleOutput.uprintfn """ #clear;; // %s""" (FSIstrings.SR.fsiIntroTextHashclearInfo ())

fsiConsoleOutput.uprintfn
""" #version;; // %s"""
(FSIstrings.SR.fsiIntroTextHashversionInfo ())

fsiConsoleOutput.uprintfn """ #quit;; // %s""" (FSIstrings.SR.fsiIntroTextHashquitInfo ())
fsiConsoleOutput.uprintfn """ #exit;; // %s""" (FSIstrings.SR.fsiIntroTextHashquitInfo ())
fsiConsoleOutput.uprintfn ""
Expand Down Expand Up @@ -3886,6 +3906,10 @@ type FsiInteractionProcessor
fsiOptions.ClearScreen()
istate, Completed None

| ParsedHashDirective("version", [], _) ->
fsiOptions.ShowVersion()
istate, Completed None

| ParsedHashDirective(("q" | "quit" | "exit"), [], _) -> fsiInterruptController.Exit()

| ParsedHashDirective("help", hashArguments, m) ->
Expand Down
5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.pl.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.pt-BR.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.ru.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.tr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.zh-Hans.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.zh-Hant.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions tests/FSharp.Compiler.ComponentTests/Scripting/Interactive.fs
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,19 @@ module MultiEmit =
"""if A.v <> 7.2 then failwith $"8: Failed {A.v} <> 7.2" """
"""if B.v <> 9.3 then failwith $"9: Failed {A.v} <> 9.3" """
|] |> Seq.iter(fun item -> item |> scriptIt)

[<Fact>]
let ``Version directive displays version and environment info``() =
Fsx """
#version;;
()
"""
|> withOptions ["--nologo"]
|> runFsi
|> shouldSucceed
|> withStdOutContains "F#"
|> withStdOutContains "Language Version:"
|> withStdOutContains "FSharp.Core:"
|> withStdOutContains ".NET:"
|> withStdOutContains "OS:"
|> ignore
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ x |> Seq.iter(fun r ->
Assert.Contains("""#r "nuget:FSharp.Data, 3.1.2";;""", output)
Assert.Contains("""#r "nuget:FSharp.Data";;""", output)
Assert.Contains("""#i "package source uri";;""", output)
Assert.Contains("#version;;", 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"""
Expand All @@ -749,6 +750,7 @@ x |> Seq.iter(fun r ->
Assert.Contains("""#r "nuget:FSharp.Data, 3.1.2";;""", output)
Assert.Contains("""#r "nuget:FSharp.Data";;""", output)
Assert.Contains("""#i "package source uri";;""", output)
Assert.Contains("#version;;", 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"""
Expand Down
1 change: 1 addition & 0 deletions tests/fsharp/core/printing/output.1000.stdout.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,7 @@ type 'a T4063 = | AT4063 of 'a
#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
#version;; // Display F# Interactive version and environment information
#quit;; // Exit
#exit;; // Exit

Expand Down
1 change: 1 addition & 0 deletions tests/fsharp/core/printing/output.200.stdout.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ type 'a T4063 = | AT4063 of 'a
#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
#version;; // Display F# Interactive version and environment information
#quit;; // Exit
#exit;; // Exit

Expand Down
1 change: 1 addition & 0 deletions tests/fsharp/core/printing/output.47.stdout.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -4062,6 +4062,7 @@ type 'a T4063 = | AT4063 of 'a
#help;; // Display help
#help "idn";; // Display documentation for an identifier, e.g. #help "List.map";;
#clear;; // Clear screen
#version;; // Display F# Interactive version and environment information
#quit;; // Exit
#exit;; // Exit

Expand Down
1 change: 1 addition & 0 deletions tests/fsharp/core/printing/output.multiemit.stdout.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -4064,6 +4064,7 @@ type 'a T4063 = | AT4063 of 'a
#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
#version;; // Display F# Interactive version and environment information
#quit;; // Exit
#exit;; // Exit

Expand Down
1 change: 1 addition & 0 deletions tests/fsharp/core/printing/output.off.stdout.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ type 'a T4063 = | AT4063 of 'a
#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
#version;; // Display F# Interactive version and environment information
#quit;; // Exit
#exit;; // Exit

Expand Down
1 change: 1 addition & 0 deletions tests/fsharp/core/printing/output.stdout.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -4064,6 +4064,7 @@ type 'a T4063 = | AT4063 of 'a
#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
#version;; // Display F# Interactive version and environment information
#quit;; // Exit
#exit;; // Exit

Expand Down
Loading