Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2064 -- Fsi: Send File Problem #2065

Merged
merged 2 commits into from
Feb 19, 2025
Merged

Conversation

LH-and-FPGA
Copy link
Contributor

No description provided.

@LH-and-FPGA
Copy link
Contributor Author

Description

This pull request fixes the issue with line number positioning when using the “Send File” command in Ionide’s FSI (related to #2064). By introducing an optional overrideLine: int option parameter in the sendCd function, it ensures that a custom line number can be used when necessary, correcting any potential misalignment issues when sending files to the F# Interactive.

Main Changes

  1. Function Signature Update
    Changed the original:

    let private sendCd (terminal: Terminal) (textEditor: TextEditor option)

    to:

    let private sendCd (terminal: Terminal) (textEditor: TextEditor option) (overrideLine: int option)

    The new overrideLine parameter allows specifying a custom line number in certain scenarios.

  2. Logic Adjustment
    Inside the function, it now uses:

    let line = defaultArg overrideLine (int textEditor.selection.start.line + 1)

    If overrideLine is not provided, it retains the original logic (using the line after the editor’s current selection). Otherwise, it uses the provided line number.

  3. Call Site Updates
    All original calls like sendCd terminal (Some editor) are replaced accordingly, passing either None or Some <line> when needed, for example:

    sendCd newTerminal window.activeTextEditor None
    sendCd terminal (Some editor) (Some 1)

    This allows flexible line number specification for scenarios like “Send File.”

Effects

  • Issue with Sending Files Resolved
    By explicitly overriding the line number, Ionide ensures that commands like “Send File” start executing from line 1, preventing unexpected behavior at the top of the file or at specific lines.

  • Backward Compatibility Preserved
    If no overrideLine is provided, it continues using the selected line from the editor, so there’s no need to change existing usage patterns.

This change allows Ionide to have better control over line numbers when sending scripts or snippets to FSI, resolving user-reported issues where the wrong line was being executed.

@LH-and-FPGA
Copy link
Contributor Author

Hi @TheAngryByrd, could you please approve the workflow run for this PR? Thanks!

Copy link
Member

@TheAngryByrd TheAngryByrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the ping!

@TheAngryByrd TheAngryByrd merged commit 228531d into ionide:main Feb 19, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants