From b6ea677d4bfa4913c3a09d942df3f6f2aca2848b Mon Sep 17 00:00:00 2001 From: nosami Date: Mon, 15 Nov 2021 13:28:17 +0000 Subject: [PATCH 1/5] Use main dotnet runtime --- vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj | 1 + vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj index 8765025e4d8..459e4b4b430 100644 --- a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj +++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj @@ -32,6 +32,7 @@ False False Release;Debug + false true diff --git a/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs b/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs index ef23b7d112d..37e80dca6b6 100644 --- a/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs +++ b/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs @@ -252,8 +252,14 @@ type FSharpInteractivePad() as this = let input = new ResizeArray<_>() let setupSession() = + let entry = Reflection.Assembly.GetEntryAssembly().Location + //let pathToExe = + // Path.Combine(Reflection.Assembly.GetExecutingAssembly().Location |> Path.GetDirectoryName, "Interactive", "MonoDevelop.FSharpInteractive.Service") + 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") + // /Users/jasonimison/src/vsmac/main/build/bin/VisualStudio.app/Contents/MonoBundle/AddIns/FSharpBinding/Interactive/MonoDevelop.FSharpInteractive.Service + let ses = InteractiveSession(pathToExe) let controller = new InteractivePadController(ses) From cad9156c82dd96bd42f81534d0756638323f87d7 Mon Sep 17 00:00:00 2001 From: nosami Date: Tue, 16 Nov 2021 16:42:23 +0000 Subject: [PATCH 2/5] net6 fixes --- .../src/FSharp.Editor/VSMac/InteractivePad.fs | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs b/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs index 37e80dca6b6..fe8853f8e68 100644 --- a/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs +++ b/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs @@ -257,7 +257,7 @@ type FSharpInteractivePad() as this = // Path.Combine(Reflection.Assembly.GetExecutingAssembly().Location |> Path.GetDirectoryName, "Interactive", "MonoDevelop.FSharpInteractive.Service") let pathToExe = - Path.Combine(Reflection.Assembly.GetExecutingAssembly().Location |> Path.GetDirectoryName, "..", "..", "..", "..", "..", "MonoDevelop.FSharpInteractive.Service") + Path.Combine(Reflection.Assembly.GetExecutingAssembly().Location |> Path.GetDirectoryName, "..", "..", "MonoDevelop.FSharpInteractive.Service") // /Users/jasonimison/src/vsmac/main/build/bin/VisualStudio.app/Contents/MonoBundle/AddIns/FSharpBinding/Interactive/MonoDevelop.FSharpInteractive.Service @@ -272,6 +272,8 @@ type FSharpInteractivePad() as this = let mutable session = None + let mutable initialized = false + let resetFsi intent = input.Clear() killIntent <- intent @@ -325,6 +327,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 @@ -371,27 +374,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 + 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 From 8a5a1851e27a019e90372e48a4646e753c857ee1 Mon Sep 17 00:00:00 2001 From: nosami Date: Wed, 17 Nov 2021 09:00:29 +0000 Subject: [PATCH 3/5] Use main dotnet runtime --- .../src/FSharp.Editor/VSMac/InteractivePad.fs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs b/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs index fe8853f8e68..b0ef930fb19 100644 --- a/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs +++ b/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs @@ -1,3 +1,4 @@ +  // // InteractivePad.fs @@ -253,13 +254,9 @@ type FSharpInteractivePad() as this = let setupSession() = let entry = Reflection.Assembly.GetEntryAssembly().Location - //let pathToExe = - // Path.Combine(Reflection.Assembly.GetExecutingAssembly().Location |> Path.GetDirectoryName, "Interactive", "MonoDevelop.FSharpInteractive.Service") let pathToExe = Path.Combine(Reflection.Assembly.GetExecutingAssembly().Location |> Path.GetDirectoryName, "..", "..", "MonoDevelop.FSharpInteractive.Service") - // /Users/jasonimison/src/vsmac/main/build/bin/VisualStudio.app/Contents/MonoBundle/AddIns/FSharpBinding/Interactive/MonoDevelop.FSharpInteractive.Service - let ses = InteractiveSession(pathToExe) let controller = new InteractivePadController(ses) @@ -272,7 +269,7 @@ type FSharpInteractivePad() as this = let mutable session = None - let mutable initialized = false + static let mutable initialized = false let resetFsi intent = input.Clear() @@ -327,7 +324,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 @@ -374,7 +371,7 @@ type FSharpInteractivePad() as this = member val Controller:InteractivePadController option = None with get, set override x.Initialize(container:MonoDevelop.Ide.Gui.IPadWindow) = - if not initialized + if not initialized then initialized <- true LoggingService.LogDebug ("InteractivePad: created!") From 7ed32ab37e1db24a870a7c2c26ea9751db9b3673 Mon Sep 17 00:00:00 2001 From: nosami Date: Wed, 17 Nov 2021 09:06:35 +0000 Subject: [PATCH 4/5] Fix up project file --- vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj | 1 - 1 file changed, 1 deletion(-) diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj index 459e4b4b430..8765025e4d8 100644 --- a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj +++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj @@ -32,7 +32,6 @@ False False Release;Debug - false true From d04586a951c9e276dcfdd32d55d9b0b6dafb9347 Mon Sep 17 00:00:00 2001 From: nosami Date: Wed, 17 Nov 2021 09:07:44 +0000 Subject: [PATCH 5/5] Clean up unused code --- vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs b/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs index b0ef930fb19..cc6cac038a4 100644 --- a/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs +++ b/vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs @@ -1,6 +1,4 @@ - - -// +// // InteractivePad.fs // // Author: @@ -253,8 +251,6 @@ type FSharpInteractivePad() as this = let input = new ResizeArray<_>() let setupSession() = - let entry = Reflection.Assembly.GetEntryAssembly().Location - let pathToExe = Path.Combine(Reflection.Assembly.GetExecutingAssembly().Location |> Path.GetDirectoryName, "..", "..", "MonoDevelop.FSharpInteractive.Service")