Skip to content

Commit 228531d

Browse files
authored
Fix #2064 -- Fsi: Send File Problem (#2065)
* Fix Fsi Send File * Fix Fsi Send File
1 parent ee363c5 commit 228531d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/Components/Fsi.fs

+8-7
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,15 @@ module Fsi =
321321
let mutable lastCurrentFile: string option = None
322322
let mutable lastCurrentLine: int option = None
323323

324-
let private sendCd (terminal: Terminal) (textEditor: TextEditor option) =
324+
let private sendCd (terminal: Terminal) (textEditor: TextEditor option) (overrideLine: int option) =
325325
let file, dir, line =
326326
match textEditor with
327327
| Some textEditor ->
328328
let file = textEditor.document.fileName
329329
let dir = node.path.dirname file
330-
let line = int textEditor.selection.start.line + 1
330+
let line = defaultArg overrideLine (int textEditor.selection.start.line + 1)
331331
file, dir, line
332+
332333
| None ->
333334
let dir = workspace.rootPath.Value
334335
node.path.join (dir, "tmp.fsx"), dir, 1
@@ -471,7 +472,7 @@ module Fsi =
471472
fsiTerminal <- Some terminal
472473

473474
// initially have to set up the terminal to be in the correct start directory
474-
sendCd newTerminal window.activeTextEditor
475+
sendCd newTerminal window.activeTextEditor None
475476

476477
return newTerminal
477478
}
@@ -529,7 +530,7 @@ module Fsi =
529530
let pos = editor.selection.start
530531
let line = editor.document.lineAt pos
531532

532-
sendCd terminal (Some editor)
533+
sendCd terminal (Some editor) None
533534

534535
do! send terminal line.text
535536
do! moveCursorDownOneLine ()
@@ -547,7 +548,7 @@ module Fsi =
547548

548549
let! terminal = getTerminal ()
549550

550-
sendCd terminal (Some editor)
551+
sendCd terminal (Some editor) None
551552

552553
let range =
553554
vscode.Range.Create(
@@ -574,7 +575,7 @@ module Fsi =
574575

575576
let! terminal = getTerminal ()
576577

577-
sendCd terminal (Some editor)
578+
sendCd terminal (Some editor) None
578579

579580
let range =
580581
vscode.Range.Create(
@@ -612,7 +613,7 @@ module Fsi =
612613
promise {
613614
let! terminal = getTerminal ()
614615

615-
sendCd terminal (Some editor)
616+
sendCd terminal (Some editor) (Some 1)
616617
do! send terminal text
617618
}
618619

0 commit comments

Comments
 (0)