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

Ability to dump current interactive session to a file #17670

Open
b4ux1t3 opened this issue Sep 8, 2024 · 3 comments
Open

Ability to dump current interactive session to a file #17670

b4ux1t3 opened this issue Sep 8, 2024 · 3 comments

Comments

@b4ux1t3
Copy link

b4ux1t3 commented Sep 8, 2024

Is your feature request related to a problem? Please describe.

I very often spend a few minutes (or even a couple hours) in fsi when prototyping out a project, and I even use it for banal things like a calculator.

Sometimes (actually, literally every time), I want to bring the code I've developed in fsi into a proper codebase. Right now, I have to go up, line by line (this can be many lines in a long prototyping session) and copy them over to a source file.

It would be much easier if you could just dump the inputs (and maybe the outputs, though less important in my opinion) to disk.

Describe the solution you'd like

I'd like there to be a hash command, something like #export, to dump the current session to a file. Maybe followed by an optional file name?

Describe alternatives you've considered

I currently just use an F# interative notebook whenever I can, but I actually spend a not-insignificant amount of time on my phone using fsi through SSH. It's functionally impractical for me to keep these sessions.

Additional context

If the issue is about:

  • improving the experience around fsi.
@github-actions github-actions bot added this to the Backlog milestone Sep 8, 2024
@b4ux1t3 b4ux1t3 changed the title ABility to dump current interactive session to a file Ability to dump current interactive session to a file Sep 8, 2024
@T-Gro
Copy link
Member

T-Gro commented Sep 9, 2024

Thanks for the proposal.

By session you mainly mean the history of the textual inputs (and possibly text outputs), all represented as plaintext?
(i.e. this is not asking for saving and opening the state of the session with fully re-hydrated objects, which would be a lot bigger ask in the general case).

@b4ux1t3
Copy link
Author

b4ux1t3 commented Sep 9, 2024

@T-Gro Yeah, I wouldn't expect to get any actual F# state. Just input text (and outputs, if that's not too complicated) as plaintext.

Maybe optionally only include valid/error-free inputs and their outputs, but simply dumping the entire text to a file would be more than enough for my own use case.

A "nice to have" version of this would be exporting to a notebook format to be ingested into dotnet interactive notebooks, but I don't think the utility of that would be all that much greater than just a text output.

@T-Gro
Copy link
Member

T-Gro commented Sep 10, 2024

I think (am already thinking in implementation specifics) that fsi could provide an object fsi.History.
With maybe a single provided default for dumping it to a file path, but nugets/snippets could decide their own actions to be done with the history of inputs/outputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New
Development

No branches or pull requests

3 participants