atom-community / atom-script

:runner: Run ( scripts | selections | source ) in Atom
https://atom.io/packages/script
MIT License
733 stars 269 forks source link

Support .NET Core #2716

Open joshcangit opened 1 year ago

joshcangit commented 1 year ago

Requirements for Adding, Changing, or Removing a Feature

Issue or RFC Endorsed by Atom's Maintainers

Description of the Change

The change use different commands for Linux. Mainly, depending on .NET Core.

For C#, dotnet is used instead of mono.

Might want to change csc to dotnet csc when that becomes available.

For C# scripts, dotnet script is used instead of scriptcs.

Might want to change to dotnet csi when that beomes available.

For F# scripts, dotnet fsi is used instead of fsharpi

Alternate Designs

I haven't made checks which may need the lookpath Node.js package. That is to check maybe if mono or dotnet is installed.

Possible Drawbacks

The dotnet script seems to be only in user directory. That may mean .csx won't work outside the user environment.

Verification Process

I use certain files to test this.

namespace HelloWorld { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); } } }


- **C# script**

//usr/bin/env dotnet script "$0" "$@";exit $?

var fw = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription; var arch = System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture; Console.WriteLine($"Hello world ({fw}, {arch})");


- **F# script**

//usr/bin/env dotnet fsi "$0" "$@";exit $?

printfn "Hello world!"



### Release Notes

<!--

Please describe the changes in a single line that explains this improvement in
terms that a user can understand. This text will be used in Atom's release notes.

If this change is not user-facing or notable enough to be included in release notes
you may use the strings "Not applicable" or "N/A" here.

Examples:

- The GitHub package now allows you to add co-authors to commits.
- Fixed an issue where multiple cursors did not work in a file with a single line.
- Increased the performance of searching and replacing across a whole project.

-->