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

C-c M-n should act on both repls in cljc files. #1297

Closed
expez opened this issue Sep 2, 2015 · 10 comments
Closed

C-c M-n should act on both repls in cljc files. #1297

expez opened this issue Sep 2, 2015 · 10 comments
Milestone

Comments

@expez
Copy link
Member

expez commented Sep 2, 2015

It works as expected in clj and cljs files but when in a cljc file I expected both repls to change.

It seems this only acts on the current-connection in cljc files.

@Malabarba
Copy link
Member

Yes, we have no special support for cljc files, so everything still acts on the current connection.
We cannot make it so that every request is dispatched to both connections (it's not infeasible, just undesirable), so this would have to be implemented on a per-command basis.

That's said, it's not clear to me that we should implement this, just because I'm not aware of what people workflows are with cljc files. What would be the least surprise here?

@expez
Copy link
Member Author

expez commented Sep 4, 2015

What would be the least surprise here?

I expected both repls to change.

I suppose that was somewhat colored by my not being able to identify what the current-connection was. I still don't know how to change the current-connection, though.

I'm not aware of what people workflows are with cljc files

When I'm working on a cljc file I'm working on a single feature, but I'm either working on the clj part of that feature or the cljs part and I'm jumping between these two contexts. What I'm not doing, which the current implementation makes easy, is working on two unrelated features. So rather than look upon this as destroying the context of the other repl I think it's more helpful to think of it as bringing them in sync.

In fact, this is what I'd like for almost all functions. E.g. C-c C-k should bring both repls up to date with the content of the current file so I can quickly verify that the cljs and clj features work the same.

@expez expez changed the title C-c M-n doesn't work in cljc file C-c M-n should at on both repls in cljc files. Sep 17, 2015
@expez expez changed the title C-c M-n should at on both repls in cljc files. C-c M-n should act on both repls in cljc files. Sep 17, 2015
@bbatsov bbatsov modified the milestone: v0.10 Nov 2, 2015
@bbatsov
Copy link
Member

bbatsov commented Nov 3, 2015

Yeah, that's a pretty interesting predicament - in the case of ambiguity we should either prompt users to decide what connection to use for the evaluation or should just eval in both connections always. The second option seems a more reasonable default. Alternatively you can have a command toggling between "use clj", "use cljs" and "use both".

@Malabarba
Copy link
Member

I think this improvement will require more infrastructure for determining the context (similar to what Lars has done in clj-refactor) and then some clever design in terms of dispatching and handling return values.

While I agree this is all worth doing, in my opinion it involves a little too much change to be doing so close to a (possible) release.

@bbatsov
Copy link
Member

bbatsov commented Nov 3, 2015

What's the relevant code in clj-refactor? Perhaps we can reuse it here.

@expez
Copy link
Member Author

expez commented Nov 3, 2015

What's the relevant code in clj-refactor?

It's here. All it does is find the language context by checking where in the reader conditional point is.

@bbatsov
Copy link
Member

bbatsov commented Nov 3, 2015

Hmm, looks like something that could easily be in clojure-mode.

@bbatsov
Copy link
Member

bbatsov commented Nov 3, 2015

I think this improvement will require more infrastructure for determining the context (similar to what Lars has done in clj-refactor) and then some clever design in terms of dispatching and handling return values.

While I agree this is all worth doing, in my opinion it involves a little too much change to be doing so close to a (possible) release.

Maybe you're right. I'll definitely not have that much time to work on CIDER before the end of the month, so if someone wants to see this land in 0.10 they should work on it themselves.

@expez
Copy link
Member Author

expez commented Nov 3, 2015

I think this discussion belongs in the issue about jumping to vars. This issue doesn't require any logic like that to be solved (act on all siblings in the project so they are in sync)

@bbatsov
Copy link
Member

bbatsov commented Nov 3, 2015

Yeah, for this particular operation the multiple requests will not be an issue, as there's no feedback that can be interleaved.

expez added a commit that referenced this issue Nov 4, 2015
In a cljc or cljx buffer hitting `C-c M-n` to switch the repl ns will
now act on both repls so they are in sync.
expez added a commit that referenced this issue Nov 4, 2015
In a cljc or cljx buffer hitting `C-c M-n` to switch the repl ns will
now act on both repls so they are in sync.
expez added a commit that referenced this issue Nov 4, 2015
In a cljc or cljx buffer hitting `C-c M-n` to switch the repl ns will
now act on both repls so they are in sync.
expez added a commit that referenced this issue Nov 4, 2015
In a cljc or cljx buffer hitting `C-c M-n` to switch the repl ns will
now act on both repls so they are in sync.
@expez expez closed this as completed in e67be7e Nov 4, 2015
bbatsov added a commit that referenced this issue Nov 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants