diff --git a/doc/IDE_SETUP.md b/doc/IDE_SETUP.md index 458db88772..692a7fc48f 100644 --- a/doc/IDE_SETUP.md +++ b/doc/IDE_SETUP.md @@ -1,5 +1,14 @@ # Using IntelliJ IDEA and Cursive +## Table of Contents + +- [Install Cursive](#install-cursive) +- [Getting Cursive to understand `status-react`](#getting-cursive-to-understand-status-react) +- [I get a lot of `cannot be resolved`](#i-get-a-lot-of-cannot-be-resolved) +- [REPL!](#repl) + - [Connecting to REPL to IntelliJ](#connecting-to-repl-to-intellij) + - [Connecting REPL and IntelliJ to `status-react`](#connecting-repl-and-intellij-to-status-react) + ## Install Cursive See https://cursive-ide.com/userguide/index.html @@ -10,13 +19,13 @@ See https://cursive-ide.com/userguide/index.html - https://gist.github.com/Samyoul/f71a0593ba7a12d24dd0d5ef986ebbec - Right click and "add as leiningen project" -![](https://notes.status.im/uploads/upload_32ea1a8eeb410effc24b5f3914e38627.png) + ## I get a lot of `cannot be resolved` Are you getting problems where you get a lot of `cannot be resolved` on everything? -![](https://notes.status.im/uploads/upload_73ed33ce7af35a289c88afdb01fc91b7.jpg) + See https://cursive-ide.com/userguide/macros.html @@ -33,21 +42,21 @@ I had a number of problems connecting to REPL, the solution is as follows: At the top of IntelliJ IDEA click on the `Add Configuration...` option: -![](https://notes.status.im/uploads/upload_b16dd48e03ef4cc98c53cc896a532f90.png) + This will load the following menu: -![](https://notes.status.im/uploads/upload_0f50285b745a00cfe3cab3c4af415d21.png) + Click on the `+` icon in the top left corner of the menu. Select `Clojure REPL > Remote` -![](https://notes.status.im/uploads/upload_0d890d5ed6e2d8d48d31cab7fa99d9e9.png) + Which will load the following menu -![](https://notes.status.im/uploads/upload_563dce472426f1f691a55713556a9b36.png) + Enter the below options: @@ -58,14 +67,14 @@ Enter the below options: - Host = 127.0.0.1 - Port = 7888 -![](https://notes.status.im/uploads/upload_88ed1d279c314d2264405f15a5e56433.png) + Press `OK` Now the below option will be visible. Press the green run button -![](https://notes.status.im/uploads/upload_d3c538110f5cc21770311b288ac382d7.png) + You should now see an dialog with the following message: @@ -88,23 +97,9 @@ Which should output => nil ``` -Or - -```shell -prn 1 -``` - -Which should output - -```shell -prn 1 -=> 1 -=> #function[clojure.core/prn] -``` - See below: -![](https://notes.status.im/uploads/upload_0f39b27d0ad287db7a5f1f180f9c55b5.png) + ### Connecting REPL and IntelliJ to `status-react` @@ -116,55 +111,37 @@ Ensure you have 3 terminals running the following - `make run-clojure` - `make run-metro` -- `make run-ios` +- `make run-ios` / `make run-android` + +[See the STARTING GUIDE for details](STARTING_GUIDE.md#development) + +Next go back to the REPL input and enter the following commands: -// TODO Add the details of selecting the ```clojure (shadow/watch :mobile) (shadow/repl :mobile) ``` -- switch clj to cljs -- You do need to switch it manually -### Connecting Cursive / IntelliJ IDEA to REPL Problems +See Below -I can connect to REPL inside the IDE, but the code doesn't seem to be able to send to REPL. But when trying to load any code into REPL I get a `Cannot load Clojure form into ClojureScript REPL`. + -My process: +Which should switch the clj file type target to cljs as shown above -Open IDEA, not yet connected to REPL and not running a terminal with `make run-clojure`. +Finally you are ready to test REPL. -![](https://notes.status.im/uploads/upload_a2abb27acbee62a0ca9ffdc41d2219dc.png) +Create a sample function to evaluate something simple like `(prn "I'm working")`, move your cursor to one of the outer parentheses. Right or `control` click and select the `REPL` option. From there select `Sync files in REPL` and then `Send '...' to REPL'`. -Attempting to connect to REPL without `make run-clojure` gives the expected error. After a terminal is running `make run-clojure`, connection works fine. + -Entering simple functions gives a response. +Alternatively you can use the shortcut commands `⇧⌘M` to sync your files and `⇧⌘P` to send the statement to REPL. You may also need to switch the REPL namespace to match the current file, which can be done manually from the dialogue box or using the `⇧⌘N` shortcut key. -![](https://notes.status.im/uploads/upload_9b2848993feb4181ad8fee96fc0dd6e9.png) +Following the above should give you the below result: -However trying to do any thing REPL-ly with the code always gives a "*Cannot load Clojure form into ClojureScript REPL*" error. + -![](https://notes.status.im/uploads/upload_d29b3ded54afdfddf0a2cb09bfdbd121.png) - -![](https://notes.status.im/uploads/upload_c07a7805e1e7c954e3d3698063410bb5.png) +🎉 Tada! Working! 🎉 --- -### Things I've also tried - -I've done some Googling to see what could be going wrong. - - -https://github.com/cursive-ide/cursive/issues/1285 This issue suggests switching the file to `cljc` which I did out of curiosity, it connects better but it doesn't really work. - -![](https://notes.status.im/uploads/upload_79bca0edc0c1841a7cbdcec50a4f90eb.png) - -Obviously this isn't ideal even if it worked perfectly, I presume that the file types are important and converting them back and forth is a terrible work flow. - -I tried converting the files to `clj`, just to see if that helped, which gave an interesting error: - -```bash= -Loading src/status_im/reloader.clj... -Syntax error (FileNotFoundException) compiling at (src/status_im/reloader.clj:1:1). -Could not locate status_im/ui/components/react__init.class, status_im/ui/components/react.clj or status_im/ui/components/react.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name. -``` \ No newline at end of file +For additional details on issues you may face when setting up REPL with Cursive [see this document](https://notes.status.im/9Gr7kqF8SzC_SmYK0eB7uQ?view#Connecting-Cursive--IntelliJ-IDEA-to-REPL-Problems) \ No newline at end of file diff --git a/doc/images/IDE_SETUP/10_REPL_8.png b/doc/images/IDE_SETUP/10_REPL_8.png new file mode 100644 index 0000000000..cddbb129fc Binary files /dev/null and b/doc/images/IDE_SETUP/10_REPL_8.png differ diff --git a/doc/images/IDE_SETUP/11_REPL_9.png b/doc/images/IDE_SETUP/11_REPL_9.png new file mode 100644 index 0000000000..6237894d5a Binary files /dev/null and b/doc/images/IDE_SETUP/11_REPL_9.png differ diff --git a/doc/images/IDE_SETUP/12_REPL_10.png b/doc/images/IDE_SETUP/12_REPL_10.png new file mode 100644 index 0000000000..1b2b56d2d8 Binary files /dev/null and b/doc/images/IDE_SETUP/12_REPL_10.png differ diff --git a/doc/images/IDE_SETUP/1_fake_project_file.png b/doc/images/IDE_SETUP/1_fake_project_file.png new file mode 100644 index 0000000000..e96e9b9c9f Binary files /dev/null and b/doc/images/IDE_SETUP/1_fake_project_file.png differ diff --git a/doc/images/IDE_SETUP/2_resolve.jpeg b/doc/images/IDE_SETUP/2_resolve.jpeg new file mode 100644 index 0000000000..a6a7989122 Binary files /dev/null and b/doc/images/IDE_SETUP/2_resolve.jpeg differ diff --git a/doc/images/IDE_SETUP/3_REPL_1.png b/doc/images/IDE_SETUP/3_REPL_1.png new file mode 100644 index 0000000000..585f3ddb7e Binary files /dev/null and b/doc/images/IDE_SETUP/3_REPL_1.png differ diff --git a/doc/images/IDE_SETUP/4_REPL_2.png b/doc/images/IDE_SETUP/4_REPL_2.png new file mode 100644 index 0000000000..1cbd4bb81c Binary files /dev/null and b/doc/images/IDE_SETUP/4_REPL_2.png differ diff --git a/doc/images/IDE_SETUP/5_REPL_3.png b/doc/images/IDE_SETUP/5_REPL_3.png new file mode 100644 index 0000000000..94b60c1bf1 Binary files /dev/null and b/doc/images/IDE_SETUP/5_REPL_3.png differ diff --git a/doc/images/IDE_SETUP/6_REPL_4.png b/doc/images/IDE_SETUP/6_REPL_4.png new file mode 100644 index 0000000000..4ffd02c326 Binary files /dev/null and b/doc/images/IDE_SETUP/6_REPL_4.png differ diff --git a/doc/images/IDE_SETUP/7_REPL_5.png b/doc/images/IDE_SETUP/7_REPL_5.png new file mode 100644 index 0000000000..5ede5f14c3 Binary files /dev/null and b/doc/images/IDE_SETUP/7_REPL_5.png differ diff --git a/doc/images/IDE_SETUP/8_REPL_6.png b/doc/images/IDE_SETUP/8_REPL_6.png new file mode 100644 index 0000000000..979d47f7f8 Binary files /dev/null and b/doc/images/IDE_SETUP/8_REPL_6.png differ diff --git a/doc/images/IDE_SETUP/9_REPL_7.png b/doc/images/IDE_SETUP/9_REPL_7.png new file mode 100644 index 0000000000..6f5669b45e Binary files /dev/null and b/doc/images/IDE_SETUP/9_REPL_7.png differ