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

afterCLJReplJackInCode fails if no editor buffer open #2025

Closed
bbqbaron opened this issue Jan 20, 2023 · 4 comments
Closed

afterCLJReplJackInCode fails if no editor buffer open #2025

bbqbaron opened this issue Jan 20, 2023 · 4 comments
Labels

Comments

@bbqbaron
Copy link

bbqbaron commented Jan 20, 2023

When eval'ing afterCLJReplJackInCode, Calva seems to crash if there isn't an active text editor. Assuming I understand the problem correctly, I'd rather it evaluate and just not print the output anywhere, rather than failing to evaluate.

Minimal workspace settings:

{
    "calva.replConnectSequences": [
        {
            "name": "Test broken jack-in",
            "projectType": "generic",
            "afterCLJReplJackInCode": "(prn \"hi\")",
            "cljsType": "none",
        },
    ]
}

Repro

There may be variations on this, but one possible flow:

  • start a headless repl in an otherwise-empty deps project
  • open a couple VSCode tabs. No files open, just tabs! Select the first tab.
  • connect to a running repl in project
  • observe an error like this in the extension logs:
2023-01-20 10:28:08.166 [error] Error: Expected active text editor!

Note that if you do open a text buffer in the active tab before connecting, jack-in works and you get "hi" in the REPL output.

I'm new to Calva's codebase, but I assume it's getActiveTextEditor blowing up when trying to eval the code?

@bbqbaron bbqbaron changed the title afterCLJReplJackInCode crashes if no editor buffer open afterCLJReplJackInCode fails if no editor buffer open Jan 20, 2023
@bbqbaron
Copy link
Author

I'd be happy to PR a change that basically just skips any statements that would have used the active editor. I'm just not sure if I'll break other flows/use cases by doing so.

PEZ added a commit that referenced this issue Jan 20, 2023
@PEZ PEZ added bug Something isn't working jack-in connect evaluation labels Jan 20, 2023
@PEZ
Copy link
Collaborator

PEZ commented Jan 20, 2023

Thanks for reporting!

I can reproduce this. Here's an example project with instructions for a minimal repro:

A PR is welcome. It does not sound right to ”just skip any statements ...”. It still could be right, it depends on which statements. 😄

@PEZ
Copy link
Collaborator

PEZ commented Jan 22, 2023

I added a PR fixing this essentially the way you suggested, @bbqbaron.

@bbqbaron
Copy link
Author

I added a PR fixing this essentially the way you suggested, @bbqbaron.

Amazing! Thanks for the quick reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants