Fork me on GitHub
#cider
<
2019-05-10
>
benedek06:05:14

not this one but clojure-lsp may support this?!

benedek06:05:10

clojure-lsp is a clojure lsp server that works with lsp-mode in emacs (hosted by the same github group)

bozhidar07:05:29

@richiardiandrea Someone from dap-mode reached out to me once, but I don’t remember the details.

bozhidar07:05:16

Seems it won’t be hard to provide a good integration between it and CIDER.

richiardiandrea15:05:18

It definitely seems cool and straightforward, maybe for Cljs and Clojure the protocol could be the same

rickmoynihan14:05:40

Did I read somewhere that there was a cider command for evaluating expressions inside a thread first / thread last?

dpsutton14:05:42

i think @richiardiandrea added a command to close as many parens as needed and eval?

rickmoynihan14:05:52

yeah that’s the one

rickmoynihan14:05:04

I glossed over some chat about it a while back

yuhan16:05:01

yup, cider-eval-sexp-up-to-point while your cursor is at the end of the expression

bozhidar16:05:43

I’ve pushed a prototype of the find usages functionality I promised a while ago.

parrot 4
bozhidar16:05:24

The magic commands are cider-xref-fn-refs and cider-xref-fn-deps. There are no keybindings or documentation at this point, and there’s plenty of room for improvement.

bozhidar16:05:29

Feedback welcome!

dpsutton16:05:58

looks like you listed jeff valk as the author of cider-xref.el. unintentional or was this file created from his stuff?

bozhidar17:05:23

My starting point was copy/pasting cider-apropos.el. 😄

dpsutton17:05:11

figure it was something like that for all the boilerplate 🙂

bozhidar17:05:06

I first thought of just dumping a list of paths with references, but because we don’t get the location of the reference itself, but that of the containing function I thought that UI made more sense.

dpsutton17:05:17

i'm getting successes with deps but not with refs

dpsutton17:05:21

what's a simple case?

dpsutton17:05:19

(defn x [] 2)
(defn y [] (x))
this works finding y as a ref for x. but on non-trivial stuff nothing so far

bozhidar19:05:26

Works for me on everything I’ve tested. Are the referencing ns-es loaded?

dpsutton17:05:22

but looks promising

skykanin17:05:42

Does Cider have any support for linting Clojure code?

borkdude17:05:11

@nicholas.jaunsen some linters are orthogonal to cider, e.g. joker or clj-kondo, they don’t need a JVM. But Eastwood does and I don’t know if that has CIDER integration.

skykanin18:05:48

I've looked at Eastwood before, but it doesn't have proper flycheck support so I can't integrate it with emacs. I would like to see the linting errors in emacs.

borkdude18:05:42

@nicholas.jaunsen joker is awesome. clj-kondo is pretty new, but can find stuff that joker cannot. I use them at the same time with flycheck

borkdude18:05:56

if you want a elisp snippet for the setup, I’ll can show you

skykanin18:05:37

That would be nice, but doesn't joker only work for clojurescript?

borkdude18:05:00

no, both clojure and clojurescript

borkdude18:05:09

even CLJC, clj-kondo too

borkdude18:05:11

for joker you’ll need: - https://github.com/candid82/joker - https://github.com/candid82/flycheck-joker for clj-kondo: - https://github.com/borkdude/clj-kondo/blob/master/doc/install.md - https://github.com/borkdude/flycheck-clj-kondo The elisp snippet to turn them on both in flycheck is at the bottom of the README of flycheck-clj-kondo.

skykanin18:05:39

I'll try it out later, thanks.

benedek19:05:07

@bozhidar i know you know but clojure-lsp's find usages is pretty good. has rename too btw

benedek19:05:42

rewrite-clj based just like clj-kondo

dpsutton19:05:59

the rename is quite nice

benedek19:05:50

use it all the time now tbh

bozhidar19:05:21

> @bozhidar i know you know but clojure-lsp’s find usages is pretty good. has rename too btw

bozhidar19:05:26

I know, I know. 🙂

bozhidar19:05:47

But I’m trying to push the envelop on REPL-powered workflows. 😉

👍 4
borkdude19:05:08

someone suggested making an nrepl integration for eastwood

bozhidar19:05:18

Yeah, that’s generally a good idea.

bozhidar19:05:29

There’s already one, but it’s not done the Right Way (tm).

benedek19:05:20

yeah that makes sense. only if you loaded the ns why not just use tools.anal.jvm? ;) (jusf pulling the leg, sry)

bozhidar19:05:02

Because I’ll have to deal with constant AST updates then. 😉

benedek19:05:21

also the rich magic only works for the jvm right?

benedek19:05:37

fair point

dominicm19:05:14

I'd love to press the repl driven attempts upstream a little, get the core team helping us out with potential changes to clojure(script).

dominicm19:05:25

Clojurescript doesn't exist without analysis, so no avoiding that afaik.

benedek19:05:16

how would you do that, dominicm?

bozhidar19:05:34

You might file a few tickets to start some conversation going. What changes do you have in mind?

dominicm19:05:16

Well, I did wonder if we could store the line number and column alongside the field in the function. That would make it possible to jump to uses exactly.

dominicm19:05:07

I haven't had an idea for finding them in def yet

bozhidar19:05:47

> Well, I did wonder if we could store the line number and column alongside the field in the function. That would make it possible to jump to uses exactly.

bozhidar19:05:13

I guess that should be some list of positions, as you can have several references to the same function.

bozhidar19:05:19

But it’d be really nice.

bozhidar19:05:23

(if possible)

bozhidar19:05:12

If there’s some sane way to get nested lambdas that’d be awesome as well. I haven’t had time to test if we can extract those from the classpath yet.

richiardiandrea20:05:08

funny I was just checking that but the new consolidated info should return meta for both clj and cljs (using the compiler state)

bozhidar20:05:16

That’s not what we’re discussing with @dominicm. The fn-refs function can find references, but it can’t tell you where exactly they are in the body of a function. Different kind of metadata.

👍 4
bozhidar20:05:34

Btw, I have no idea what keyboard prefix to use for the xref commands - too many keybindings are already taken. If someone has great ideas - be my guest. 🙂

richiardiandrea20:05:18

I guess r is used for refresh?

bozhidar20:05:46

It’s taken, but I don’t remember for what.

bozhidar20:05:12

We need C-c C-something something or C-c M-something something else.