@@ -321,14 +321,15 @@ module Fsi =
321
321
let mutable lastCurrentFile : string option = None
322
322
let mutable lastCurrentLine : int option = None
323
323
324
- let private sendCd ( terminal : Terminal ) ( textEditor : TextEditor option ) =
324
+ let private sendCd ( terminal : Terminal ) ( textEditor : TextEditor option ) ( overrideLine : int option ) =
325
325
let file , dir , line =
326
326
match textEditor with
327
327
| Some textEditor ->
328
328
let file = textEditor.document.fileName
329
329
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 )
331
331
file, dir, line
332
+
332
333
| None ->
333
334
let dir = workspace.rootPath.Value
334
335
node.path.join ( dir, " tmp.fsx" ), dir, 1
@@ -471,7 +472,7 @@ module Fsi =
471
472
fsiTerminal <- Some terminal
472
473
473
474
// 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
475
476
476
477
return newTerminal
477
478
}
@@ -529,7 +530,7 @@ module Fsi =
529
530
let pos = editor.selection.start
530
531
let line = editor.document.lineAt pos
531
532
532
- sendCd terminal ( Some editor)
533
+ sendCd terminal ( Some editor) None
533
534
534
535
do ! send terminal line.text
535
536
do ! moveCursorDownOneLine ()
@@ -547,7 +548,7 @@ module Fsi =
547
548
548
549
let! terminal = getTerminal ()
549
550
550
- sendCd terminal ( Some editor)
551
+ sendCd terminal ( Some editor) None
551
552
552
553
let range =
553
554
vscode.Range.Create(
@@ -574,7 +575,7 @@ module Fsi =
574
575
575
576
let! terminal = getTerminal ()
576
577
577
- sendCd terminal ( Some editor)
578
+ sendCd terminal ( Some editor) None
578
579
579
580
let range =
580
581
vscode.Range.Create(
@@ -612,7 +613,7 @@ module Fsi =
612
613
promise {
613
614
let! terminal = getTerminal ()
614
615
615
- sendCd terminal ( Some editor)
616
+ sendCd terminal ( Some editor) ( Some 1 )
616
617
do ! send terminal text
617
618
}
618
619
0 commit comments