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

How to make Cursive REPL work with Arcadia Unity? #942

Closed
madvas opened this issue Jul 2, 2015 · 6 comments
Closed

How to make Cursive REPL work with Arcadia Unity? #942

madvas opened this issue Jul 2, 2015 · 6 comments

Comments

@madvas
Copy link

madvas commented Jul 2, 2015

Hi,

Arcadia is a integration of Clojure into Unity Game Engine.

It ships with a simple networked REPL. They've got a tutorial how to integrate it with Emacs, Vim and Sublime, unfortunately not Cursive. I'm pretty new to Clojure overall, so my understanding of this is limited.

This is ruby script which ships with Arcadia, to start REPL from command line

require "io/wait"
require "socket"

$input = ""
$input.force_encoding("UTF-8")
$s = UDPSocket.new

def repl_send code, strip_nil=false
  $s.send code, 0, "localhost", 11211
  $s.wait
  out = $s.recv($s.nread)
  print strip_nil ? out.gsub(/\s*nil$/, "\n") : out
  $stdout.flush
end

def balanced? code
  s = code.clone
  s.gsub! /[^\(\)\[\]\{\}]/, ""
  until s.gsub!(/\(\)|\[\]|\{\}/, "").nil?; end
  s.empty?
end

repl_send DATA.read.strip, true

while true
  $input += $stdin.gets.force_encoding("UTF-8")
  if balanced? $input
    repl_send $input
    $input = ""
  end
end

at_exit do
  $s.close
end

__END__
(do (println "; Arcadia REPL")
    (println (str "; Clojure " (clojure-version)))
    (println (str "; Unity " (UnityEditorInternal.InternalEditorUtility/GetFullUnityVersion)))
    (println (str "; Mono " (.Invoke (.GetMethod Mono.Runtime "GetDisplayName" (enum-or BindingFlags/NonPublic BindingFlags/Static)) nil nil))))⏎

I've try to create Remote Clojure REPL to connect to port 11211, but it says: Error connecting to localhost:11211 - class java.net.ConnectException: Connection refused.

Does anybody have an idea how to make this work?

@cursive-ide
Copy link
Owner

I actually spoke to Tim about this at Clojure/West - it's tricky, unfortunately. Currently Cursive's REPL assumes that you're running something Java-based, which is not the case here. It's probably possible to have a fairly simple workaround for that, but there's an additional problem. Cursive will probably never be a good fit for Arcadia because IntelliJ provides no support for .NET. Cursive uses IntelliJ's infrastructure to provide its code intelligence, and without that support it's likely to be very annoying to use since Arcadia uses a lot of .NET interop. Since IntelliJ (and thus Cursive) doesn't understand that, it'll assume you're trying to use Java and it won't work well at all.

There's unlikely to be a fix for this any time soon, sorry.

@madvas
Copy link
Author

madvas commented Jul 2, 2015

oh, not the best news, cuz I really like Cursive, good job ;) Hopefully IntelliJ will provide support for .NET in a future

@cursive-ide
Copy link
Owner

Thanks! I'm glad you're enjoying it.

That would be nice, but I think it's unlikely given that it would compete with their existing products (ReSharper etc). I could probably add some simple support for it, but realistically hardly anyone uses Clojure.CLR so it's not the best use of my time right now. Perhaps in the future.

In the meantime, I'm going to close this issue.

@madvas
Copy link
Author

madvas commented Jul 2, 2015

okay just to make this clear for me. It would be problematic to make plugin for ReSharper, which would be basically the same, but it'd use .NET code intelligence?

@cursive-ide
Copy link
Owner

No, what I mean is that JetBrains are unlikely to add .NET support to IntelliJ because one of their main products is ReSharper, which does mostly the same thing but plugs into Visual Studio.

@LispEngineer
Copy link

FYI: JetBrains now has Rider, which is a full, Unity-integrated C# development environment, so this would be great to see now. :)

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

3 participants