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

Eval current form (when require call) causes REPL window to switch to user ns #302

Closed
bpringe opened this issue Sep 6, 2019 · 3 comments

Comments

@bpringe
Copy link
Member

bpringe commented Sep 6, 2019

This used to not occur on master as of 2.0.33, but it does now. I know because I do this sequence often in my daily work.

Here are the repro steps:

  1. Run calva jack-in
  2. Switch to a project file's namespace - (open file then ctrl+alt+c, ctrl+alt+n)
  3. Send require statement from code file (in a comment block) to the REPL window for eval - ctrl+alt+c, e on something like (require '[hello.world.test-req :as tr])
  4. Run *ns* in the REPL window where the prompt looks like the previously switched to namespace, but notice that it says you're in the user namespace. If you try to eval something from the namespace of the prompt, it will say undefined because you're REPL is actually in the user namespace.

This is different from the issue where trying to resolve an undefined var switches the namespace, because it switched namespace on the require statement sent from the editor window. Also, there are no errors in the namespace being required (just to clarify).

@bpringe
Copy link
Member Author

bpringe commented Sep 6, 2019

Update: This is more of an issue than I thought. I made sure to do a fresh install of Calva to make sure I didn't have any custom changes installed (removed the old extension folder in ~./vscode/extensions).

I realized any time the "eval current form" command is run, the namespace in the REPL window switches back to user.

Updated steps to reproduce:

  1. Run calva jack-in
  2. Switch to a project file's namespace - (open file then ctrl+alt+c, ctrl+alt+n)
  3. Type a statement like (println "hello") in your code file
  4. Send the above line to be eval'd in the repl - ctrl+alt+c, e
  5. Run *ns* in the REPL and see that it's in the user namespace

Image demo; That println statement was sent using the eval current form command.

image

Update 2: I tried to debug this. I stepped through the execution of the sendTextToREPLWindow function and everything looked correct as far as which namespace it was using. I don't know at what point after that command it's switching the namespace back to user, and how it could be doing that.

@PEZ
Copy link
Collaborator

PEZ commented Sep 8, 2019

Sounds bad. I'll have a look at it today.

@PEZ
Copy link
Collaborator

PEZ commented Sep 9, 2019

OK. This will take a little while to figure out. It is hard to diff because the changes are in different repositories. But I will probably solve this together with another issue regarding namespace behaviour in the REPL window. No ETA, yet, but nag me on Friday if no updates here by then. 😄

@PEZ PEZ closed this as completed in 12bcbe1 Sep 12, 2019
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

No branches or pull requests

2 participants