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
26 changes: 24 additions & 2 deletions src/fsharp/FSharp.Compiler.Private.Scripting/FSharpScript.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,38 @@ open System.Threading
open FSharp.Compiler
open FSharp.Compiler.Interactive.Shell

type FSharpScript(?additionalArgs: string[]) =
[<RequireQualifiedAccess>]
type LangVersion =
| V47
| V50
| Preview

type FSharpScript(?additionalArgs: string[], ?quiet: bool, ?langVersion: LangVersion) =

let additionalArgs = defaultArg additionalArgs [||]
let quiet = defaultArg quiet true
let langVersion = defaultArg langVersion LangVersion.Preview

let config = FsiEvaluationSession.GetDefaultConfiguration()

let computedProfile =
// If we are being executed on the desktop framework (we can tell because the assembly containing int is mscorlib) then profile must be mscorlib otherwise use netcore
if typeof<int>.Assembly.GetName().Name = "mscorlib" then "mscorlib"
else "netcore"
let baseArgs = [| typeof<FSharpScript>.Assembly.Location; "--noninteractive"; "--targetprofile:" + computedProfile; "--quiet" |]

let baseArgs = [|
typeof<FSharpScript>.Assembly.Location;
"--noninteractive";
"--targetprofile:" + computedProfile
if quiet then "--quiet"
match langVersion with
| LangVersion.V47 -> "--langversion:4.7"
| LangVersion.V50 -> "--langversion:5.0"
| LangVersion.Preview -> "--langversion:preview"
|]
Comment on lines +29 to +38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let baseArgs = [|
typeof<FSharpScript>.Assembly.Location;
"--noninteractive";
"--targetprofile:" + computedProfile
if quiet then "--quiet"
match langVersion with
| LangVersion.V47 -> "--langversion:4.7"
| LangVersion.V50 -> "--langversion:5.0"
| LangVersion.Preview -> "--langversion:preview"
|]
let baseArgs =
[|
typeof<FSharpScript>.Assembly.Location;
"--noninteractive";
"--targetprofile:" + computedProfile
if quiet then "--quiet"
match langVersion with
| LangVersion.V47 -> "--langversion:4.7"
| LangVersion.V50 -> "--langversion:5.0"
| LangVersion.Preview -> "--langversion:preview"
|]


let argv = Array.append baseArgs additionalArgs

let fsi = FsiEvaluationSession.Create (config, argv, stdin, stdout, stderr)

member __.ValueBound = fsi.ValueBound
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
cantReferenceSystemPackage,"PackageManager can not reference the System Package '%s'"
requiresAValue,"%s requires a value"
unableToApplyImplicitArgument,"Unable to apply implicit argument number %d"
notUsed,"Not used."
notUsed,"Not used"
loadNugetPackage,"Load Nuget Package"
version,"version"
highestVersion,"with the highest version"
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ type FSharpDependencyManager (outputDir:string option) =

member _.Key = key

member _.HelpMessages = [|
sprintf """ #r "nuget:FSharp.Data, 3.1.2";; // %s 'FSharp.Data' %s '3.1.2'""" (SR.loadNugetPackage()) (SR.version())
sprintf """ #r "nuget:FSharp.Data";; // %s 'FSharp.Data' %s""" (SR.loadNugetPackage()) (SR.highestVersion())
|]

Comment on lines +166 to +170
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
member _.HelpMessages = [|
sprintf """ #r "nuget:FSharp.Data, 3.1.2";; // %s 'FSharp.Data' %s '3.1.2'""" (SR.loadNugetPackage()) (SR.version())
sprintf """ #r "nuget:FSharp.Data";; // %s 'FSharp.Data' %s""" (SR.loadNugetPackage()) (SR.highestVersion())
|]
member _.HelpMessages =
[|
sprintf """ #r "nuget:FSharp.Data, 3.1.2";; // %s 'FSharp.Data' %s '3.1.2'""" (SR.loadNugetPackage()) (SR.version())
sprintf """ #r "nuget:FSharp.Data";; // %s 'FSharp.Data' %s""" (SR.loadNugetPackage()) (SR.highestVersion())
|]

member _.ResolveDependencies(scriptExt:string, packageManagerTextLines:string seq, tfm: string, rid: string) : obj =

let scriptExt, poundRprefix =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ type FSharpDependencyManager =

member Key:string

member HelpMessages:string[]

member ResolveDependencies: scriptExt:string * packageManagerTextLines:string seq * tfm: string * rid: string -> obj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
<target state="translated">PackageManager se nemůže odkazovat na systémový balíček {0}.</target>
<note />
</trans-unit>
<trans-unit id="highestVersion">
<source>with the highest version</source>
<target state="new">with the highest version</target>
<note />
</trans-unit>
<trans-unit id="loadNugetPackage">
<source>Load Nuget Package</source>
<target state="new">Load Nuget Package</target>
<note />
</trans-unit>
<trans-unit id="notUsed">
<source>Not used.</source>
<target state="translated">Nepoužito</target>
<source>Not used</source>
<target state="needs-review-translation">Nepoužito</target>
<note />
</trans-unit>
<trans-unit id="requiresAValue">
Expand All @@ -22,6 +32,11 @@
<target state="translated">Nepovedlo se použít implicitní počet argumentů {0}.</target>
<note />
</trans-unit>
<trans-unit id="version">
<source>version</source>
<target state="new">version</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
<target state="translated">PackageManager kann nicht auf das Systempaket "{0}" verweisen.</target>
<note />
</trans-unit>
<trans-unit id="highestVersion">
<source>with the highest version</source>
<target state="new">with the highest version</target>
<note />
</trans-unit>
<trans-unit id="loadNugetPackage">
<source>Load Nuget Package</source>
<target state="new">Load Nuget Package</target>
<note />
</trans-unit>
<trans-unit id="notUsed">
<source>Not used.</source>
<target state="translated">Nicht verwendet.</target>
<source>Not used</source>
<target state="needs-review-translation">Nicht verwendet.</target>
<note />
</trans-unit>
<trans-unit id="requiresAValue">
Expand All @@ -22,6 +32,11 @@
<target state="translated">Die Zahl für das implizierte Argument ({0}) kann nicht angewendet werden.</target>
<note />
</trans-unit>
<trans-unit id="version">
<source>version</source>
<target state="new">version</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
<target state="translated">PackageManager no puede hacer referencia al paquete del sistema "{0}".</target>
<note />
</trans-unit>
<trans-unit id="highestVersion">
<source>with the highest version</source>
<target state="new">with the highest version</target>
<note />
</trans-unit>
<trans-unit id="loadNugetPackage">
<source>Load Nuget Package</source>
<target state="new">Load Nuget Package</target>
<note />
</trans-unit>
<trans-unit id="notUsed">
<source>Not used.</source>
<target state="translated">No utilizado.</target>
<source>Not used</source>
<target state="needs-review-translation">No utilizado.</target>
<note />
</trans-unit>
<trans-unit id="requiresAValue">
Expand All @@ -22,6 +32,11 @@
<target state="translated">No se puede aplicar el número de argumento implícito {0}.</target>
<note />
</trans-unit>
<trans-unit id="version">
<source>version</source>
<target state="new">version</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
<target state="translated">PackageManager ne peut pas référencer le package système '{0}'</target>
<note />
</trans-unit>
<trans-unit id="highestVersion">
<source>with the highest version</source>
<target state="new">with the highest version</target>
<note />
</trans-unit>
<trans-unit id="loadNugetPackage">
<source>Load Nuget Package</source>
<target state="new">Load Nuget Package</target>
<note />
</trans-unit>
<trans-unit id="notUsed">
<source>Not used.</source>
<target state="translated">Non utilisé.</target>
<source>Not used</source>
<target state="needs-review-translation">Non utilisé.</target>
<note />
</trans-unit>
<trans-unit id="requiresAValue">
Expand All @@ -22,6 +32,11 @@
<target state="translated">Impossible d'appliquer le numéro d'argument implicite {0}</target>
<note />
</trans-unit>
<trans-unit id="version">
<source>version</source>
<target state="new">version</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
<target state="translated">PackageManager non può fare riferimento al pacchetto di sistema '{0}'</target>
<note />
</trans-unit>
<trans-unit id="highestVersion">
<source>with the highest version</source>
<target state="new">with the highest version</target>
<note />
</trans-unit>
<trans-unit id="loadNugetPackage">
<source>Load Nuget Package</source>
<target state="new">Load Nuget Package</target>
<note />
</trans-unit>
<trans-unit id="notUsed">
<source>Not used.</source>
<target state="translated">Non utilizzato.</target>
<source>Not used</source>
<target state="needs-review-translation">Non utilizzato.</target>
<note />
</trans-unit>
<trans-unit id="requiresAValue">
Expand All @@ -22,6 +32,11 @@
<target state="translated">Non è possibile applicare il numero di argomento implicito {0}</target>
<note />
</trans-unit>
<trans-unit id="version">
<source>version</source>
<target state="new">version</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
<target state="translated">PackageManager がシステム パッケージ '{0}' を参照できません</target>
<note />
</trans-unit>
<trans-unit id="highestVersion">
<source>with the highest version</source>
<target state="new">with the highest version</target>
<note />
</trans-unit>
<trans-unit id="loadNugetPackage">
<source>Load Nuget Package</source>
<target state="new">Load Nuget Package</target>
<note />
</trans-unit>
<trans-unit id="notUsed">
<source>Not used.</source>
<target state="translated">使用されていません。</target>
<source>Not used</source>
<target state="needs-review-translation">使用されていません。</target>
<note />
</trans-unit>
<trans-unit id="requiresAValue">
Expand All @@ -22,6 +32,11 @@
<target state="translated">暗黙的な引数番号 {0} を適用できません</target>
<note />
</trans-unit>
<trans-unit id="version">
<source>version</source>
<target state="new">version</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
<target state="translated">PackageManager에서 시스템 패키지 '{0}'을(를) 참조할 수 없습니다.</target>
<note />
</trans-unit>
<trans-unit id="highestVersion">
<source>with the highest version</source>
<target state="new">with the highest version</target>
<note />
</trans-unit>
<trans-unit id="loadNugetPackage">
<source>Load Nuget Package</source>
<target state="new">Load Nuget Package</target>
<note />
</trans-unit>
<trans-unit id="notUsed">
<source>Not used.</source>
<target state="translated">사용되지 않습니다.</target>
<source>Not used</source>
<target state="needs-review-translation">사용되지 않습니다.</target>
<note />
</trans-unit>
<trans-unit id="requiresAValue">
Expand All @@ -22,6 +32,11 @@
<target state="translated">암시적 인수 번호 {0}을(를) 적용할 수 없습니다.</target>
<note />
</trans-unit>
<trans-unit id="version">
<source>version</source>
<target state="new">version</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
<target state="translated">Program PacketManager nie może odwoływać się do pakietu systemowego „{0}”</target>
<note />
</trans-unit>
<trans-unit id="highestVersion">
<source>with the highest version</source>
<target state="new">with the highest version</target>
<note />
</trans-unit>
<trans-unit id="loadNugetPackage">
<source>Load Nuget Package</source>
<target state="new">Load Nuget Package</target>
<note />
</trans-unit>
<trans-unit id="notUsed">
<source>Not used.</source>
<target state="translated">Nieużywane.</target>
<source>Not used</source>
<target state="needs-review-translation">Nieużywane.</target>
<note />
</trans-unit>
<trans-unit id="requiresAValue">
Expand All @@ -22,6 +32,11 @@
<target state="translated">Nie można zastosować niejawnego argumentu o numerze {0}</target>
<note />
</trans-unit>
<trans-unit id="version">
<source>version</source>
<target state="new">version</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
<target state="translated">PackageManager não pode referenciar o pacote do sistema '{0}'</target>
<note />
</trans-unit>
<trans-unit id="highestVersion">
<source>with the highest version</source>
<target state="new">with the highest version</target>
<note />
</trans-unit>
<trans-unit id="loadNugetPackage">
<source>Load Nuget Package</source>
<target state="new">Load Nuget Package</target>
<note />
</trans-unit>
<trans-unit id="notUsed">
<source>Not used.</source>
<target state="translated">Não usado.</target>
<source>Not used</source>
<target state="needs-review-translation">Não usado.</target>
<note />
</trans-unit>
<trans-unit id="requiresAValue">
Expand All @@ -22,6 +32,11 @@
<target state="translated">Não é possível aplicar o número do argumento implícito {0}</target>
<note />
</trans-unit>
<trans-unit id="version">
<source>version</source>
<target state="new">version</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
Loading