Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.
Merged
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
42 changes: 23 additions & 19 deletions vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

//
//
// InteractivePad.fs
//
// Author:
Expand Down Expand Up @@ -253,7 +252,7 @@ type FSharpInteractivePad() as this =

let setupSession() =
let pathToExe =
Path.Combine(Reflection.Assembly.GetExecutingAssembly().Location |> Path.GetDirectoryName, "Interactive", "MonoDevelop.FSharpInteractive.Service")
Path.Combine(Reflection.Assembly.GetExecutingAssembly().Location |> Path.GetDirectoryName, "..", "..", "MonoDevelop.FSharpInteractive.Service")

let ses = InteractiveSession(pathToExe)
let controller = new InteractivePadController(ses)
Expand All @@ -266,6 +265,8 @@ type FSharpInteractivePad() as this =

let mutable session = None

static let mutable initialized = false

let resetFsi intent =
input.Clear()
killIntent <- intent
Expand Down Expand Up @@ -319,6 +320,7 @@ type FSharpInteractivePad() as this =
static member Fsi =
FSharpInteractivePad.Pad |> Option.bind (fun pad -> Some(pad.Content :?> FSharpInteractivePad))


member x.LastOutputLine
with get() = lastLineOutput
and set value = lastLineOutput <- value
Expand Down Expand Up @@ -365,27 +367,29 @@ type FSharpInteractivePad() as this =
member val Controller:InteractivePadController option = None with get, set

override x.Initialize(container:MonoDevelop.Ide.Gui.IPadWindow) =
LoggingService.LogDebug ("InteractivePad: created!")
if not initialized then
initialized <- true
LoggingService.LogDebug ("InteractivePad: created!")

let toolbar = new Toolbar()
let toolbar = new Toolbar()

let addButton icon action tooltip =
let button = ToolbarButtonItem(null, icon)
button.Icon <- icon
button.Clicked.Add (fun _ -> action())
button.Tooltip <- GettextCatalog.GetString tooltip
toolbar.AddItem(button)
let addButton icon action tooltip =
let button = ToolbarButtonItem(null, icon)
button.Icon <- icon
button.Clicked.Add (fun _ -> action())
button.Tooltip <- GettextCatalog.GetString tooltip
toolbar.AddItem(button)

addButton "gtk-save" x.Save "Save as script"
addButton "gtk-open" x.OpenScript "Open"
addButton "gtk-clear" x.ClearFsi "Clear"
addButton "gtk-refresh" x.RestartFsi "Reset"
addButton "gtk-save" x.Save "Save as script"
addButton "gtk-open" x.OpenScript "Open"
addButton "gtk-clear" x.ClearFsi "Clear"
addButton "gtk-refresh" x.RestartFsi "Reset"

let ses = setupSession()
session <- ses |> Some
let ses = setupSession()
session <- ses |> Some

if not ses.HasStarted then ses.StartReceiving()
container.SetToolbar(toolbar, DockPositionType.Right)
if not ses.HasStarted then ses.StartReceiving()
container.SetToolbar(toolbar, DockPositionType.Right)

member x.RestartFsi() = resetFsi Restart

Expand Down