fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

dotnet FSI should expose the GUI operations "Clear All" and "Reset Interactive Environment"

Open snuup opened this issue 1 year ago • 1 comments

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

A common working loop is editing fsx files and running parts of such scripts, like

#r "xxx.dll"
... 

let algo() =
    ... some console output here
algo()

In this example, if we execute the code fragment from let algo() ... until the call of algo(), then we hide previous algo instances and rerun the fresh, latest version. So far so good. But to read the output in the F# Interactive output window we often need to search for the begin of the last execution of algo(). The output window gets longer and longer and the effort for this search continually increases. A "Reset interactive Environment" or a "Clear All" with the context menu of the output window clears the window, the reset also removes the accumulated hidden variables.

image

Describe the solution you'd like

I would like to call the 2 operations

  • Reset Interactive Environment
  • Clear All

from the fsi object. I could then write the script:

fsi.ClearAll()

fsi.ClearAll()
let algo() =                                 
    ... some console output here  
algo()                                         

which avoids switching between keyboard and mouse and fiddling with the context menu. Having

fsi.ResetInteractiveEnvironment()

at the top of the script would easily allow reevaluation of the whole script without leaving the keyboard: Select all text and execute the selected code via keyboard shortcut.

snuup avatar Feb 21 '24 09:02 snuup

fsi.ClearAll() maybe is System.Console.Clear()

ijklam avatar Feb 21 '24 14:02 ijklam