cider

A channel dedicated to the Clojure Interactive Development Environment that Rocks (aka CIDER). :cider:
2021-02-17T09:21:26.316600Z

Has anyone seen an error like this before in the nrepl middleware? Not entirely sure what causes it - but I think it happens when there’s an exception and cider tries to print it

2021-02-17T09:21:38.316700Z

2021-02-17T09:22:15.317300Z

Trigger by evaling (throw (ex-info "foo" {}))

2021-02-17T09:24:22.318Z

hmm looks like it might be a subtle env issue with jdk’s and JAVA_HOME etc… 👀

2021-02-17T09:48:30.319700Z

yeah ok that seems to have fixed it… JAVA_HOME was pointing to the system java rather than the one I was using… slight jabba misconfiguration

2021-02-17T09:50:33.320300Z

hmm odd I’ve just seen the exception again… looks like this hasn’t fixed it after all :thinking_face:

2021-02-17T11:32:41.324300Z

hey guys, has any of you experienced a weird behaviour while using clj-refactor where cider seems to be resolving to the wrong project type ? I have a deps.edn-based project and it is supposed to handle refactoring commands pertaining to that particular type of project. Though when launching an add-project-dependency for e.g it tells me that it tried to lookup for a :dependencies key which means that somehow it considers the project as a leiningen-based one.

Debugger entered--Lisp error: (search-failed ":dependencies")
  re-search-forward(":dependencies")
  cljr--insert-into-leiningen-dependencies("mount" "0.1.16")
  cljr--add-project-dependency("mount" "0.1.16")
  cljr-add-project-dependency(nil)
  funcall-interactively(cljr-add-project-dependency nil)
  #<subr call-interactively>(cljr-add-project-dependency nil nil)
  apply(#<subr call-interactively> cljr-add-project-dependency (nil nil))
  (let ((ido-cr+-current-command command)) (apply orig-fun command args))
  call-interactively@ido-cr+-record-current-command(#<subr call-interactively> cljr-add-project-dependency nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (cljr-add-project-dependency nil nil))
  call-interactively(cljr-add-project-dependency nil nil)
  command-execute(cljr-add-project-dependency)

bozhidar 2021-02-17T11:35:04.324900Z

@rickmoynihan If this started happening recently, it might be related to the fixes we've tried for https://github.com/clojure-emacs/orchard/issues/103

bozhidar 2021-02-17T11:35:53.325800Z

I'm assuming that something might be missing in your JDK 8 installation. Probably you won't get the error with JDK 11.

2021-02-17T11:35:55.325900Z

@bozhidar yeah I think it’s happened recently since I updated

bozhidar 2021-02-17T11:36:16.326300Z

Mention your issue in the ticket, so Jeff's aware of this.

bozhidar 2021-02-17T11:36:48.327300Z

The Java integration is one of the most frustrating things in CIDER, as things there constantly break...

bozhidar 2021-02-17T11:37:18.328Z

Now I miss the days where each JDK took 5 years to ship. 😄

2021-02-17T11:38:41.329400Z

Ok, interesting… I could possibly use jdk11, though it’ll mean I need to use two jdks for different services

2021-02-17T11:57:43.330Z

nevermind, I debugged it using edebug and figured out that it was because I had a pom.xml inside the project (which was generated by clj-new)

(defun cljr--add-project-dependency (artifact version)
  (let* ((project-file (cljr--project-file))
         (deps (cljr--project-with-deps-p project-file)))
    (cljr--update-file project-file
      (goto-char (point-min))
      (if deps ;; SO WHEN deps IS nil 
          (cljr--insert-into-clj-dependencies artifact version)
        (cljr--insert-into-leiningen-dependencies artifact version)) ;; clj-refactor CONSIDERS THE PROJECT AS A lein-based ONE
      (cljr--post-command-message "Added %s version %s as a project dependency" artifact version)
      (when cljr-hotload-dependencies
        (if deps
            (back-to-indentation)
          (paredit-backward-down))
        (cljr-hotload-dependency)))))

witek 2021-02-17T12:48:53.332100Z

Hello. I am missing a CIDER command: cider-toggle-ignore-next-form. It should either place or remove #_ at current cursor position. What is the honorable thing to do? Just put it in my custom config? Pull-Request to the Spacemacs configuration layer? Pull-Request to CIDER?

bozhidar 2021-02-17T15:16:42.332700Z

@witek It should like something that should be in clojure-mode, as it doesn't require a REPL to work.

bozhidar 2021-02-17T15:17:39.333500Z

I'm just wondering that's the value of adding a command that adds or delete two characters at point. Probably that'd be more useful if it was applied to the preceding or containing form.

👍 1
bozhidar 2021-02-17T15:17:52.333800Z

(as it saves you the extra movement)

enn 2021-02-17T16:02:37.335500Z

Any tips for troubleshooting a slow cider-connect? The ;; Connected to nREPL server - <nrepl://localhost:49906>... comment appears immediately, but it takes about 45 seconds for the user&gt; to appear. I’m using cider-nrepl 0.25.9 and the CIDER snapshot <tel:202102131151|20210213.1151> on Emacs 27.1. I start the server with lein repl.

dpsutton 2021-02-17T16:34:36.336200Z

first guess, its the state tracker populating the emacs side with all the known namespaces and vars

enn 2021-02-17T16:42:11.338200Z

@dpsutton that makes sense--this is a large project. Is there any way to pre-calculate this (something we could do in our build)?

dpsutton 2021-02-17T16:44:13.338900Z

my suspicion is its not the calculation of it but just sending to emacs, parsing, and storing in memory. so no good solution off hand that i can think of (if this is even the problem anyways)

dpsutton 2021-02-17T16:44:29.339300Z

i think you can turn this off and you'll just lose a bit of syntax highlighting

dpsutton 2021-02-17T16:49:35.339600Z

wow. i'm not actually seeing a way to not subscribe to this information

enn 2021-02-17T16:55:55.341Z

I tried enabling debug on quit and hitting C-g during the wait, as the troubleshooting guide that @bozhidar linked to suggests, but I don’t get any backtrace or any other information. so I’m not sure how to confirm your hypothesis. for a given REPL process, if I disconnect and then reconnect, the second connection is instantaneous.

dpsutton 2021-02-17T16:56:24.341200Z

yeah that's really about a hanging process

bozhidar 2021-02-17T16:57:18.342Z

Yeah, you can't. It should probably be configurable, but it's not as even basic things like the connection type are handled by it.

dpsutton 2021-02-17T16:57:35.342500Z

start profiling, cider connect, wait until it unfreezes and run profiler-report. note do not run profiler-stop. you'd think you start, stop, see results. but you can only see results of actively running profilers.

dpsutton 2021-02-17T16:58:59.342600Z

yeah. i imagine the connection type always stays in there. just not the huge map of dictionaries of nses

dpsutton 2021-02-17T16:59:10.342800Z

i remember someone having an issue with millions of keywords or something like that

dpsutton 2021-02-17T16:59:19.343Z

surprised one result of that wasn't to turn off the tracking

enn 2021-02-17T19:55:40.343300Z

profiling output in thread

enn 2021-02-17T19:56:07.343800Z

- command-execute                                           9,655,949  73%
 - call-interactively                                       9,655,949  73%
  - funcall-interactively                                   9,655,949  73%
   - counsel-M-x                                            9,655,949  73%
    - ivy-read                                              9,355,822  70%
     - ivy-call                                             7,208,547  54%
      - counsel-M-x-action                                  7,208,547  54%
       - command-execute                                    7,208,547  54%
        - call-interactively                                7,208,547  54%
         - funcall-interactively                            7,208,515  54%
          - cider-connect                                   3,652,581  27%
           - cider--update-host-port                        2,435,135  18%
            - cider-select-endpoint                         2,435,135  18%
             - cider--ssh-hosts                             1,562,797  11%
              + eval                                        1,542,325  11%
              + seq-map                                        17,400   0%
              + version&lt;                                        3,072   0%
             + cider--completing-read-port                    373,606   2%
             + cider--completing-read-host                    237,411   1%
             + cider--infer-ports                             235,481   1%
             + seq-uniq                                        24,816   0%
               split-string                                     1,024   0%
           - cider-nrepl-connect                            1,208,190   9%
            - nrepl-start-client-process                    1,208,190   9%
             + run-hooks                                      651,591   4%
             + #&lt;compiled 0x1feb8b26da11&gt;                     477,204   3%
             + nrepl--init-capabilities                        45,358   0%
             + nrepl--init-client-sessions                     18,584   0%
             + nrepl-connect                                    7,181   0%
           + cider--update-project-dir                          5,120   0%
           - cider--check-existing-session                      4,136   0%
            + sesman-current-sessions                           4,136   0%
          + profiler-report                                 3,555,279  26%
            profiler-start                                        655   0%
     + read-from-minibuffer                                 1,657,843  12%
     + ivy--reset-state                                       356,434   2%
     + ivy--update-prompt                                       3,104   0%
     + #&lt;compiled 0x1feb870c8e1d&gt;                               1,056   0%
    + counsel--M-x-externs                                    300,127   2%
+ timer-event-handler                                       1,626,289  12%
+ nrepl-client-filter                                         833,280   6%
+ redisplay_internal (C function)                             786,459   5%
+ ucs-normalize-hfs-nfd-pre-write-conversion                  115,835   0%
+ linum-update-current                                         75,598   0%
+ ...                                                          45,360   0%
+ ucs-normalize-hfs-nfd-post-read-conversion                   41,344   0%
+ eldoc-schedule-timer                                            584   0%

enn 2021-02-17T19:56:23.344Z

don’t really see any smoking gun here

dpsutton 2021-02-17T19:58:27.344200Z

did you run this report after the 45 second freeze?

dpsutton 2021-02-17T19:58:35.344400Z

maybe run it during the 45 second freeze?

enn 2021-02-17T21:06:42.344600Z

I ran the report after (but it was profiling the whole time). I will try running the report during.

FiVo 2021-02-17T22:18:10.345700Z

Is there a way to run some snippet just after jack in? Similar to cider-custom-cljs-repl-init-form but just for clj.