-
Notifications
You must be signed in to change notification settings - Fork 108
Using IntelliJ Cursive with Arcadia
Folcon edited this page Sep 26, 2021
·
20 revisions
An example project to get started, if anyone has any feedback for improvements please create an issue!: https://github.com/Folcon/arcadia-example-project
- IntelliJ and Cursive are installed
- Unity is installed and you have set up the project according to the Usage guide. You now have an Assets folder with Arcadia in it.
- For demonstration purposes, I have named my project CursiveArcadia in the examples that follow
- In IntelliJ, File > Open... Select your Unity Project
- In the Project Panel on the left, select the Assets directory
- Right click, mark the directory as Sources Root
- Create a new Clojure Namespace within the Assets directory, name it anything you want.
- At the top, you'll get a warning that no Project SDK is defined. Click the suggested link, and choose the default IDE jdk (unless you have some other jdk you would prefer)
- To get autocompletion running against your project and its dependencies, refresh your leiningen projects (double tapping shift and searching for
Refresh Leiningen Projects
) or restart Intellij. You will need to do this again whenever you add new external clojure files to the project. - See the magic at work! In your Clojure code, require the Arcadia project and you should see IntelliJ suggest autocompletion options for you.
- You have completed the steps above
- Specifically, you need to have an IntelliJ project that contains the Assets directory of your Unity Project.
- Clone the The Arcadia nREPL project into your Assets folder and, per the docs, place a .nrepl-port file into the project directory:
$ cd path/to/your/unity/project/Assets
$ git clone [email protected]:spacepluk/arcadia.nrepl.git
$ echo 7888 > arcadia.nrepl/.nrepl-port
- In your IntelliJ project Panel, navigate to the project.clj of the newly cloned project and right click. Select "Add as Leiningen Project"
- You'll need to create 2 new run configurations. One to start the nREPL bridge, and one to connect to it. In the toolbar, select Edit Configurations (if your toolbar isn't displayed, just google how to edit run configurations in IntelliJ)
- Create your first run configuration. Select the Leiningen configuration from the drop down, ensure the settings match up with the picture shown below, and click "apply" before proceeding to the next step:
- Create your second run configuration. Select the Clojure REPL > Remote configuration from the drop down, ensure the settings match up with the picture shown below, and click "apply"
- With your Unity project open, run the Start Arcadia REPL configuration, wait for it to start up, and then run your Connect to Arcadia REPL config.
- You'll see the terminal output showing the nREPL bridge starting up (mine shows some kind of irrelevant error), and you'll see the REPL window appear on the left. Evaluate the arcadia require statement, then eval a log statement and see it show up in the Unity console!