emacs

Consider also joining #cider, #lsp and #inf-clojure, where most of the tool-specific discussions are happening.
2020-08-26T07:11:20.026200Z

Is there anything like anakondo (i.e. that can operate without a repl) that will do jump to definition?

jakemcc 2020-08-27T20:41:36.046600Z

dumb-jump is pretty good and works across many languages https://github.com/jacktasia/dumb-jump

2020-08-28T08:41:42.047300Z

@jakemcc: Interesting… I guess unlike alc.index-defs though, that it can’t jump to dependencies / git deps etc

2020-08-28T08:42:38.047500Z

still nice to have an option giving broad shallow coverage, rather than narrow but deep.

jakemcc 2020-08-28T21:01:14.066300Z

@rickmoynihan yeah. I really enjoy having it as the backstop. Can open many languages that I'm not set up for and get some amount of jumping within that project.

2020-08-26T07:19:13.026600Z

if you don't mind static generation periodically that takes some time, yes

2020-08-26T07:19:24.026800Z

https://github.com/sogaiu/alc.index-defs

2020-08-26T07:19:40.027300Z

this uses clj-kondo's analysis

2020-08-26T07:19:59.027600Z

yeah was looking for something that uses clj-kondo; thanks

2020-08-26T07:20:03.027800Z

👀

2020-08-26T07:20:22.028Z

for use with emacs: https://github.com/sogaiu/alc.index-defs/blob/master/doc/emacs.md

2020-08-26T07:21:12.028600Z

note that this doesn't do locals

2020-08-26T07:26:45.028900Z

Cool seems to work on one project but on another it raises an exception…

ag 2020-08-26T07:26:46.029100Z

lsp

2020-08-26T07:27:37.029300Z

$ clj -Sdeps '{:deps {alc.index-defs {:git/url "<https://github.com/sogaiu/alc.index-defs>" :sha "4d26c6109fad267839ba10e7144660193a8be9a2"}}}' -m alc.index-defs.etags
* checking specified options
  input: {:proj-dir /Users/rick/repos/project, :format :etags}
  output: {:proj-dir /Users/rick/repos/project, :format :etags, :out-name TAGS, :overwrite false, :verbose true}
* determining paths to analyze
  found shadow-cljs.edn
  found deps.edn
  &gt;&gt; classpath computation by: shadow-cljs &lt;&lt;
  found yarn.lock
  found package-lock.json
  &gt;&gt; yarn.lock newer &lt;&lt;
  chose yarn to invoke shadow-cljs
Execution error (NumberFormatException) at java.lang.Integer/parseInt (Integer.java:542).
null

Full report at:
/var/folders/ln/536xqskd3_g80n5pdbsjkrjw0000gn/T/clojure-7955288199004901369.edn

2020-08-26T07:28:14.029500Z

exception is:

2020-08-26T07:28:22.029700Z

2020-08-26T07:28:37.030100Z

I can open an issue for it if you like

2020-08-26T07:29:31.030300Z

ah thanks -- if that's convenient for you. i'm also ok to take details here.

2020-08-26T07:29:54.030500Z

are there some bits i might use to reproduce?

2020-08-26T07:30:10.030700Z

it’s a proprietary project, so not really 😞

2020-08-26T07:30:33.030900Z

ah i see.

2020-08-26T07:30:54.031100Z

it looks like it involves some cljs -- is that correct?

2020-08-26T07:31:19.031300Z

yeah it’s clj and cljs/cljc combined in the same source tree

2020-08-26T07:31:48.031500Z

shadow-cljs build for clojurescript side, deps.edn project

2020-08-26T07:31:48.031700Z

is the shadow-cljs version recent?

2020-08-26T07:32:07.031900Z

ok, you can actually select to have clj compute the classpath.

2020-08-26T07:32:14.032100Z

shadow-cljs reports: cli version: 2.8.26 node: v13.7.0

2020-08-26T07:32:55.032500Z

ah ok

2020-08-26T07:32:58.032700Z

that's the issue

2020-08-26T07:33:03.032900Z

that shadow-cljs is too old

2020-08-26T07:33:26.033100Z

the ability for shadow-cljs to do classpath computation was 2.8.53 or so and above iiuc

2020-08-26T07:33:35.033300Z

will try bumping it and see if it resolves it… we normally keep it pretty up to date, but shadow moves pretty quick

2020-08-26T07:34:09.033500Z

indeed it does!

2020-08-26T07:34:30.033700Z

for reference you can choose to use clj do the classpath computation: https://github.com/sogaiu/alc.index-defs/blob/master/doc/technical-details.md

2020-08-26T07:35:56.034100Z

adding something like:

'{:method :deps}'
to the invocation at the end may work

2020-08-26T07:36:39.034300Z

will that still index the cljs?

2020-08-26T07:36:57.034500Z

i think it depends on what clj gives back as the classpath

2020-08-26T07:37:27.034700Z

so the classpath computation is used by clj-kondo to decide what to index (iirc, it's been a while since i've looked at the code 😅 )

2020-08-26T07:37:34.034900Z

yeah in that case it should work

2020-08-26T07:40:28.035100Z

hmm so firstly I think I’ve upgraded shadow-cljs now, and I still seem to get the same error

2020-08-26T07:40:47.035300Z

hmm, may i ask which version?

2020-08-26T07:40:59.035500Z

2.11.0

2020-08-26T07:41:14.035700Z

ok, thanks. i haven't tried that version yet, but will do so.

2020-08-26T07:41:44.035900Z

cool… secondly adding the '{:method :deps}' arguments also fails

2020-08-26T07:41:54.036100Z

is it the same error?

2020-08-26T07:42:07.036300Z

no

2020-08-26T07:42:10.036500Z

* checking specified options
  input: {:proj-dir /Users/rick/repos/muttnik, :method :deps, :format :etags}
  output: {:proj-dir /Users/rick/repos/muttnik, :method :deps, :format :etags, :out-name TAGS, :overwrite false, :verbose true}
* determining paths to analyze
  found shadow-cljs.edn
  found deps.edn
  &gt;&gt; classpath computation by: deps &lt;&lt;
Execution error (IllegalArgumentException) at alc.index-defs.impl.analyze/study-project-and-deps (analyze.clj:104).
No method in multimethod 'get-lint-paths' for dispatch value: :deps

Full report at:
/var/folders/ln/536xqskd3_g80n5pdbsjkrjw0000gn/T/clojure-6386543814520584285.edn

2020-08-26T07:42:32.036700Z

2020-08-26T07:43:15.037100Z

very sorry it hasn't worked for you 😞 i will investigate. thanks for trying things out.

2020-08-26T07:43:40.037300Z

@sogaiu: Not at all, I’m sorry for giving you a hard time 🙂

2020-08-26T07:44:00.037500Z

It seems to work on a different project

2020-08-26T07:44:05.037700Z

ah, sorry

2020-08-26T07:44:12.037900Z

please try '{:method :clj}'

2020-08-26T07:44:15.038100Z

my bad

2020-08-26T07:44:16.038300Z

ahh

2020-08-26T07:44:25.038500Z

yeah was just about to take a look myself

2020-08-26T07:44:42.038700Z

i grepped my shell history and had made an erroneous invocation before 😅

2020-08-26T07:45:19.038900Z

ok it’s doing something this time 🤞

2020-08-26T07:46:05.039100Z

(i hope the shadow-cljs upgrade is ok)

2020-08-26T07:46:35.039300Z

well I’ll only commit it, if it is 🙂

2020-08-26T07:47:00.039500Z

ah yes, the wonders of revision control 🙂

2020-08-26T07:47:58.039700Z

A colleague of mine is usually pretty fastidious at keeping that dependency upgraded… he’s obviously been slacking this time 😆

2020-08-26T07:48:12.039900Z

or may be he knows that things break 😛

2020-08-26T07:48:47.040100Z

he’ll be on it if it does, he’s pretty good at working through those issues

2020-08-26T07:50:19.040400Z

ok this seems to have worked… thanks a tonne for the help, and great project. It’ll save me starting a REPL when I want to do a casual code review on small PRs, or help colleagues understand what is going on

2020-08-26T07:50:46.040600Z

thanks for trying things out! please let me know if you have any problems / suggestions 🙂

2020-08-26T07:51:56.040800Z

I have one suggestion actually… Adding support for the new -F/ -X params

2020-08-26T07:53:12.041100Z

Oh actually you already basically do… aic/do-it takes a map of opts already :thinking_face:

2020-08-26T07:59:36.041300Z

thanks! i haven't tried the -F/-X stuff but will investigate.

2020-08-26T08:01:06.041500Z

Ok I’ve just set it up this way in my ~/.clojure/deps.edn:

2020-08-26T08:01:11.041700Z

:build-tags {:deps {alc.index-defs {:git/url "<https://github.com/sogaiu/alc.index-defs>" :sha "4d26c6109fad267839ba10e7144660193a8be9a2"}}
               :fn alc.index-defs.core/do-it!
               :args {:format :etags
                      :proj-dir "."
                      :method :clj}}

2020-08-26T08:01:39.041900Z

You can then call it from any project with: clj -A:build-deps -X:build-deps

2020-08-26T08:03:16.042100Z

(IIRC a newer (future) version of tools.deps will mean you won’t need to also pass -A:build-deps, just -X:build-deps would be enough)

2020-08-26T08:39:32.042400Z

thanks for taking the time to explain!

ericdallo 2020-08-26T13:10:06.043200Z

@sogaiu take a look at https://github.com/snoe/clojure-lsp using https://emacs-lsp.github.io/lsp-mode/, you can have multiple features like go-to-definition, find references, code actions, clj-kondo analysis, breadcrumb, modeline diagnostics and a lot more 🙂 You can see the major features https://emacs-lsp.github.io/lsp-mode/page/main-features/

ericdallo 2020-08-26T13:11:15.043700Z

for more info about lsp you can ask on #lsp too

2020-08-26T21:48:33.044100Z

thanks i have tried a few times before :)

2020-08-26T21:51:33.044300Z

i also usually prefer modular independent pieces and am not really into "servers", but having said that, i am happy there are multiple approaches. good to have choice in these matters :)

ericdallo 2020-08-26T21:53:35.044500Z

Yes 🙂 it's better than having no option

2020-08-26T21:54:41.044700Z

ha ha, indeed!