From c0c4f4928f8bdc24c71e76c9bf029db7bc8bdd8d Mon Sep 17 00:00:00 2001 From: LH-and-FPGA <180024497+LH-and-FPGA@users.noreply.github.com> Date: Sat, 15 Feb 2025 19:01:41 +0000 Subject: [PATCH 1/2] Fix Fsi Send File --- src/Components/Fsi.fs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Components/Fsi.fs b/src/Components/Fsi.fs index 0cda51bc..58324a77 100644 --- a/src/Components/Fsi.fs +++ b/src/Components/Fsi.fs @@ -321,17 +321,20 @@ module Fsi = let mutable lastCurrentFile: string option = None let mutable lastCurrentLine: int option = None - let private sendCd (terminal: Terminal) (textEditor: TextEditor option) = + let private sendCd (terminal: Terminal) (textEditor: TextEditor option) (overrideLine: int option) = let file, dir, line = match textEditor with | Some textEditor -> let file = textEditor.document.fileName let dir = node.path.dirname file - let line = int textEditor.selection.start.line + 1 + let line = defaultArg overrideLine (int textEditor.selection.start.line + 1) file, dir, line + | None -> let dir = workspace.rootPath.Value - node.path.join (dir, "tmp.fsx"), dir, 1 + let file = node.path.join (dir, "tmp.fsx") + let line = defaultArg overrideLine 1 + file, dir, line match lastCd with // Same dir as last time, no need to send it @@ -612,7 +615,7 @@ module Fsi = promise { let! terminal = getTerminal () - sendCd terminal (Some editor) + sendCd terminal (Some editor) (Some 1) do! send terminal text } From cabc1a22b17f88069fd4d4acee65f34150b46dd0 Mon Sep 17 00:00:00 2001 From: LH-and-FPGA <180024497+LH-and-FPGA@users.noreply.github.com> Date: Sat, 15 Feb 2025 22:46:12 +0000 Subject: [PATCH 2/2] Fix Fsi Send File --- src/Components/Fsi.fs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Components/Fsi.fs b/src/Components/Fsi.fs index 58324a77..bf704810 100644 --- a/src/Components/Fsi.fs +++ b/src/Components/Fsi.fs @@ -332,9 +332,7 @@ module Fsi = | None -> let dir = workspace.rootPath.Value - let file = node.path.join (dir, "tmp.fsx") - let line = defaultArg overrideLine 1 - file, dir, line + node.path.join (dir, "tmp.fsx"), dir, 1 match lastCd with // Same dir as last time, no need to send it @@ -474,7 +472,7 @@ module Fsi = fsiTerminal <- Some terminal // initially have to set up the terminal to be in the correct start directory - sendCd newTerminal window.activeTextEditor + sendCd newTerminal window.activeTextEditor None return newTerminal } @@ -532,7 +530,7 @@ module Fsi = let pos = editor.selection.start let line = editor.document.lineAt pos - sendCd terminal (Some editor) + sendCd terminal (Some editor) None do! send terminal line.text do! moveCursorDownOneLine () @@ -550,7 +548,7 @@ module Fsi = let! terminal = getTerminal () - sendCd terminal (Some editor) + sendCd terminal (Some editor) None let range = vscode.Range.Create( @@ -577,7 +575,7 @@ module Fsi = let! terminal = getTerminal () - sendCd terminal (Some editor) + sendCd terminal (Some editor) None let range = vscode.Range.Create(