This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-03
Channels
- # announcements (4)
- # aws (13)
- # babashka (35)
- # beginners (162)
- # boot (8)
- # calva (5)
- # chlorine-clover (15)
- # cider (64)
- # clj-kondo (20)
- # cljs-dev (29)
- # clojars (6)
- # clojure (166)
- # clojure-europe (3)
- # clojure-finland (6)
- # clojure-france (8)
- # clojure-germany (3)
- # clojure-italy (3)
- # clojure-nl (7)
- # clojure-spec (49)
- # clojure-uk (83)
- # clojurescript (39)
- # clojurex (5)
- # core-typed (2)
- # cursive (3)
- # data-science (17)
- # datascript (3)
- # datomic (22)
- # exercism (5)
- # fulcro (3)
- # jobs-discuss (2)
- # joker (2)
- # kaocha (3)
- # malli (26)
- # off-topic (89)
- # pathom (10)
- # pedestal (14)
- # protorepl (14)
- # re-frame (23)
- # reitit (2)
- # shadow-cljs (27)
- # slack-help (10)
- # spacemacs (14)
- # tools-deps (10)
- # tree-sitter (3)
- # xtdb (19)
- # yada (2)
Just to be sure I'm not missing anything - does Cider currently offer any way to view the constructor types or arguments for a Java interop form? eg.
(Classname. ,,,)
cider-doc
and eldoc don't appear to display any relevant information.More concretely, something like (Integer. 1.0)
throws the error "No matching ctor found" without any hint of what ctors it's matching against, and I end up having to leave Emacs and trawl through Javadocs to figure out what what the constructors and argument types are.
@qythium This certainly worked at some point - you’d get all the constructors in the eldoc.
What’s your JDK? Many Java-related things broke after Java 8 because of the modules system.
I'm not sure if that ever worked or not; I guess I'm looking at constructors very infrequently.
@qythium for your particular case it could be better to look at static methods just typing Integer/
, pressing TAB for autocomplete and "showing javadoc" via Shift+K (in Spacemacs) works for me (parameters are shown, not actual javadoc).
@bozhidar
It's true that lot of things (like javadoc and source code navigation) broke after switch to JDK >8;
It would be nice to know if there are any future plans to address this soon since JDK 8 has become quite old at this point 🙂
@jumar Plans I have plenty, but with so many projects that I’m juggling I’m certainly short on time. 🙂
@jumar K (cider-doc) -> show javadoc works for certain builtin classes but not external libraries, and it opens in a separate web browser app
Mine shows inline docs, it's not the same as standard javadoc function; That's also why it works for some external libs - they are defined here: https://github.com/clojure/clojure/blob/master/src/clj/clojure/java/javadoc.clj#L29-L41
Does it work on anyone else's setup? If it's a missing feature I could open an issue in the relevant GH repo (orchard / cider-nrepl)
Some external libraries work but not others, I guess not every package has a generated javadocs website (not sure how that works)
when I use projectile-toggle-between-implementation-and-test to switch between test and src file. I got: No matching test file found for project type ’generic
@i to get projectile to work with a mono-repo (multiple clojure projects within a project) I used the following .dir-locals.el
file https://github.com/practicalli/codewars-guides/blob/master/.dir-locals.el This enables projectile to toggle between implementation and test correctly. It should work for both deps and leiningen projects
You can change nil
to clojure-mode
if you want to limit the scope to clojure (something I forgot to do). I dont think it causes any side effects as it is anyway.
@i you wish to evaluate the top level expression, so its cider-eval-defun-at-point
or as its on the same line, you could also do cider-eval-sexp-end-of-line
but the defn command is generally more useful.
(defn reverse-string [s] ;; <- arglist goes here ;; your code goes here (apply <caret> str (reverse “asdf”)))
I made my own wrapper for this purpose - basically (up-list) then (cider-eval-last-sexp)
@i those functions work for the original question you asked. Now you have changed the code by wrapping it in a defn.
I dont understand what you are trying to do now, there is no point wrapping it in a defn if you are not using the argument received by the defn.
Replace the "asdf" with s (a terrible arg name by the way) and then just write an expression to call the defn and evaluate that.
(reverse-string "asdf")
. Using eval-defn works with this expression and is what your tests will do (I assume you doing the exercism challenge this comes from)
and you just put that at the root of the monorepo? much nicer than running touch .projectile
on all my subprojects
Yes, having one .dir-locals.el worked more effectively for me than the .projectile files.
works like a charm! awesome trick
after doing a bit of hacking around in orchard.java
I found the following to work in both cider-doc and eldoc:
(in-ns 'cider.nrepl.inlined-deps.orchard.v0v5v7.orchard.java) ;; or replace with your corresponding inlined ns
(reset! cache {})
(defn type-info
"For the class or interface symbol, return Java type info. If the type has
defined contructors, the line and column returned will be for the first of
these for more convenient `jump` navigation."
[class]
(let [info (class-info class)
ctors (vals (get-in info [:members class]))
first-ctor (->> ctors
(sort-by :line)
(filter :line)
(first))]
(-> info
(dissoc :members)
(assoc :arglists
(map #(if (:argnames %)
(mapv (fn [n t] (symbol (str t " " n))) (:argnames %) (:argtypes %))
(:argtypes %)) ctors))
(merge (select-keys first-ctor [:line :column])))))
@qythium I think it’s best to submit this as GH ticket/PR, so it’s easier to discuss the code there. Slack is poorly suited for this purpose IMO. 🙂
I'm probably doing something questionable by constructing a symbol with a space in it.. I wonder how else to represent both the type and arg name
Would appreciate if someone could help test this out informally before I package it into a PR for orchard - my JVM knowledge is pretty minimal and I could be missing something
I think I have asked this question before, but can't remember the answer. I installed a local version of nrepl
via lein install
and now removed it from ~/.m2/...
but when I jack in it still says nREPL 0.7.0-alpha3
.
@finn.volkel You need to update your CIDER snapshot.
CIDER specifies the version of nREPL to use internally if you’re using cider-jack-in
.
See cider-nrepl-required-version
. CIDER plugs this into the command it uses to start the server.
thanks, it's now on the correct version. I don't know what I did, but today it's the correct verison.
@finn.volkel sounds like you have nrepl version set in Leiningen profil
Having trouble with Spacemacs. Has been working great for the last 2 years or so but today, for some reason, my `*cider-repl*` buffer stopped launching for no reason that I have been able to discover. I've tried multiple launching different projects, thinking maybe there was something in the configuration of a specific project, which did not work. I've tried creating a new project, which also did not work. I moved my previous `.emacs.d` folder to a backup location and create a fresh install of Spacemacs but no luck. Here is the tall end of the `*Messages*` buffer for the fresh install
Done (Total of 1 file compiled, 2 skipped)
(Spacemacs) --> installing package: yasnippet@auto-completion... [155/155]
Auto-evilification could not remap these functions in map 'edebug-mode-map':
- 'edebug-Go-nonstop-mode' originally mapped on 'G'
Auto-evilification could not remap these functions in map 'tar-mode-map':
- 'tar-chgrp-entry' originally mapped on 'G'
(Spacemacs) Warning: tern binary not found!
Loading /Users/marcusoladell/.emacs.d/layers/+distributions/spacemacs-base/keybindings.el (source)...done
Loading /Users/marcusoladell/.emacs.d/layers/+source-control/version-control/keybindings.el (source)...done
Loading /Users/marcusoladell/.emacs.d/.cache/recentf...done
Saving file /Users/marcusoladell/.spacemacs...
Wrote /Users/marcusoladell/.spacemacs [2 times]
Spacemacs is ready.
Open the quickhelp.
Start checking for new version...
Spacemacs is up to date.
[yas] Check your `yas-snippet-dirs': /Users/marcusoladell/.emacs.d/elpa/yasnippet-20200329.1434/snippets is not a directory
[yas] Prepared just-in-time loading of snippets with some errors. Check *Messages*.
[nREPL] Starting server via /usr/local/bin/lein update-in :dependencies conj \[nrepl\ \"0.7.0\"\] -- update-in :plugins conj \[refactor-nrepl\ \"2.5.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.25.0-SNAPSHOT\"\] -- repl :headless :host localhost
Quit
[nREPL] Starting server via /usr/local/bin/lein update-in :dependencies conj \[nrepl\ \"0.7.0\"\] -- update-in :plugins conj \[refactor-nrepl\ \"2.5.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.25.0-SNAPSHOT\"\] -- repl :headless :host localhost
<left-fringe> <drag-mouse-1> is undefined
Many of these warnings or errors I have seen before things went sideways today. Not sure if they are relevant to what is happening. The `nrepl-server` launches successfully. I just don't get any `*cider-nrepl*` buffer connected to it. 😕
I don’t see any CIDER-specific errors in the log you’ve posted. You might want to check https://docs.cider.mx/cider/troubleshooting.html
thanks.
It does. in the end, it was a versioning issue with various pieces of the middleware.
(originally posted this to #spacemacs but seems more appropriate here)