Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paste as F# feature #1979

Open
jkone27 opened this issue Jan 28, 2024 · 0 comments
Open

Paste as F# feature #1979

jkone27 opened this issue Jan 28, 2024 · 0 comments

Comments

@jkone27
Copy link

jkone27 commented Jan 28, 2024

websites like:

https://codingfleet.com/code-converter/csharp/fsharp/

integrate with some GPT / LLLM engine to convert code X to F# code, useful e.g. for C# examples (most examples for .net are in C# not F#). This could provide ways to convert code from lang-x to lang-y, probably using LLM/GPT behind the scenes,
would be great to have an integration of this kind in ionide

after copying C# code (or javascript or python code) from a project, we could "paste as F# code"

example

// Create a canvas
var canvas = new Canvas(16, 16);

// Draw some shapes
for(var i = 0; i < canvas.Width; i++)
{
    // Cross
    canvas.SetPixel(i, i, Color.White);
    canvas.SetPixel(canvas.Width - i - 1, i, Color.White);

    // Border
    canvas.SetPixel(i, 0, Color.Red);
    canvas.SetPixel(0, i, Color.Green);
    canvas.SetPixel(i, canvas.Height - 1, Color.Blue);
    canvas.SetPixel(canvas.Width - 1, i, Color.Yellow);
}

// Render the canvas
AnsiConsole.Write(canvas);

gets converted to

// added as we paste from C#, most likely needed
#nowarn "20"

// Create a canvas
let canvas = new Canvas(16, 16)

// Draw some shapes
for i in 0 .. canvas.Width - 1 do
    // Cross
    canvas.SetPixel(i, i, Color.White)
    canvas.SetPixel(canvas.Width - i - 1, i, Color.White)

    // Border
    canvas.SetPixel(i, 0, Color.Red)
    canvas.SetPixel(0, i, Color.Green)
    canvas.SetPixel(i, canvas.Height - 1, Color.Blue)
    canvas.SetPixel(canvas.Width - 1, i, Color.Yellow)

// Render the canvas
AnsiConsole.Write(canvas)

which is indeed equivalent

@jkone27 jkone27 changed the title Add Paste as F#, integrate with some GPT / LLLM engine to convert code X to F# code, useful e.g. for C# examples Paste as F# feature Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant