lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
ericdallo 2021-02-23T00:16:25.166400Z

Thank you for the support ❀️

ericdallo 2021-02-23T00:21:48.166900Z

I'm getting:

Could not find artifact com.datomic:dev-local:jar:0.9.225 in central (<https://repo1.maven.org/maven2/>)
when add that datomic deps

mikejcusack 2021-02-23T00:30:06.167100Z

What is the dep config you have?

mikejcusack 2021-02-23T00:31:17.167400Z

Oh, missed the bit at the top. You do have to sign up for it after all: https://cognitect.com/dev-tools

mikejcusack 2021-02-23T00:31:25.167600Z

But still just an email sign-up

ericdallo 2021-02-23T00:31:30.167800Z

{:deps {org.clojure/clojure {:mvn/version "1.10.2"}}
 :paths ["src" "resource"]
 :aliases {:dev {:extra-paths ["dev"]
                 :extra-deps {com.datomic/dev-local {:mvn/version "0.9.225"}
                              org.clojure/tools.namespace {:mvn/version "1.1.0"}}}}}

ericdallo 2021-02-23T00:31:32.168Z

oh

mikejcusack 2021-02-23T00:32:05.168200Z

But once it gets used it does get added to .m2/repository

ericdallo 2021-02-23T00:32:06.168400Z

Do I need to download the dep manually?

mikejcusack 2021-02-23T00:32:14.168600Z

Follow the link

ericdallo 2021-02-23T00:37:57.168800Z

Ok, I managed to run the clj command right now

ericdallo 2021-02-23T00:41:14.169Z

It works properly πŸ˜”

mikejcusack 2021-02-23T00:47:01.169400Z

That's datomic.client.api. That one works for me

mikejcusack 2021-02-23T00:47:14.169600Z

We're talking about com.datomic/dev-local

ericdallo 2021-02-23T00:47:37.169800Z

I have that deps already, what is the namespace so?

ericdallo 2021-02-23T00:48:20.170Z

[datomic.dev-local :as dev-local]
?

mikejcusack 2021-02-23T00:48:28.170200Z

yeah

ericdallo 2021-02-23T00:49:53.170400Z

Alright, finally I could reproduce it

ericdallo 2021-02-23T00:50:15.170600Z

for datomic.dev-local , the completions indeed don't work, I'll investigate

πŸ‘ 1
mikejcusack 2021-02-23T00:50:57.170900Z

I know I'm brand new to Doom, but I didn't think it was my setup

ericdallo 2021-02-23T00:51:05.171100Z

The issue is that clj-kondo is not anaylizing that

ericdallo 2021-02-23T00:51:24.171300Z

you can confirm that if you hover over the namespace require and call lsp-clojure-cursor-info

ericdallo 2021-02-23T00:51:29.171500Z

it prints nil on the definition

mikejcusack 2021-02-23T00:51:39.171700Z

Right, I mentioned that earlier

mikejcusack 2021-02-23T00:51:48.171900Z

And doesn't on datomic.client.api

mikejcusack 2021-02-23T00:52:12.172100Z

And datomic-cloud comes from an S3 bucket so that's external too

ericdallo 2021-02-23T00:52:33.172300Z

for me it prints for datomic-client.api

ericdallo 2021-02-23T00:52:47.172500Z

I'll now confirm if it's a clj-kondo issue and not a clojure-lsp one

mikejcusack 2021-02-23T00:53:04.172700Z

Yeah, still curious why mine isn't caching

ericdallo 2021-02-23T00:53:39.172900Z

not sure clj-kondo uses different cache path based on OS

mikejcusack 2021-02-23T00:54:21.173100Z

I'm in Arch Linux

ericdallo 2021-02-23T00:55:15.173300Z

I'm on NixOS, but problably not related

mikejcusack 2021-02-23T00:56:13.173500Z

I looked at Nix, but couldn't move forward with the fact that packages have to be built on your machine or they won't work. I love the declarative aspect of it though

ericdallo 2021-02-23T00:57:00.173800Z

I have my whole system on my dotfiles and it works across different systems πŸ™‚

ericdallo 2021-02-23T00:57:17.174Z

Just need one file for the boot of each hardaware, the rest works perfect

mikejcusack 2021-02-23T00:57:43.174200Z

Yeah, that's nice. I just like being able to use pre-built binaries for certain things

ericdallo 2021-02-23T00:58:42.174400Z

yeah, that has tradeoffs, I was a Debian user some years ago

mikejcusack 2021-02-23T01:00:45.174600Z

I've been on Arch for over 15 years. Have looked around, but nothing was compelling enough to leave. The AUR and ABS are very convenient for when I need something that isn't in the main repos or needs to be tweaked or I can update it before the official maintainers.

ericdallo 2021-02-23T01:01:42.174800Z

Yes, Arch would be my second choice if there is no Nix πŸ˜…

πŸ™Œ 1
ericdallo 2021-02-23T01:02:17.175100Z

So, I'm trying to use clj-kondo via terminal to lint the classpath and check if it is a issue there

mikejcusack 2021-02-23T01:07:53.175300Z

So read the readme for clj-kondo and it mentions that you have to create the .clj-kondo/. I created it in the project and now there is a cache

ericdallo 2021-02-23T01:09:12.175500Z

oh, didn't know about that.. I thought it's created automatically

ericdallo 2021-02-23T01:09:23.175700Z

probably it was using a cache but in another folder like tmp

ericdallo 2021-02-23T01:09:55.175900Z

or ~/.clj-kondo/.cache

mikejcusack 2021-02-23T01:10:45.176100Z

That didn't change the behavior though

mikejcusack 2021-02-23T01:18:01.176300Z

I created the full cache from the classpath and it shows up in the cache

ericdallo 2021-02-23T01:20:45.177400Z

try call clj-kondo --lint /tmp/foo.clj --config '{:output {:analysis true :format :edn}}' to get clj-kondo analysis

ericdallo 2021-02-23T01:20:53.177600Z

that what's clojure-lsp uses

mikejcusack 2021-02-23T01:25:33.178800Z

I don't see anything odd in it

ericdallo 2021-02-23T01:26:54.179200Z

we need to check if it's missing datomic.dev-local analysis

ericdallo 2021-02-23T01:27:12.179400Z

like functions from that namespace that should show in completion

ericdallo 2021-02-23T01:29:14.180200Z

Oh, we should call differently, we need to pass the classpath instead of a folder, or pass the path to the datomic.dev-local jar/file

ericdallo 2021-02-23T01:29:17.180400Z

I'll try it

ericdallo 2021-02-23T01:32:20.180900Z

Something like:

clj -Sdeps '{:deps {clj-kondo {:mvn/version "2021.02.14-20210218.170309-6"}}}' -m clj-kondo.main --config '{:output {:analysis true :format :json}}'  --lint "~/.m2/repository/com/datomic/dev-local/0.9.225/dev-local-0.9.225.jar:datomic/dev_local.clj" |jq .

ericdallo 2021-02-23T01:35:11.181100Z

Oh, I know what is probably the issue

ericdallo 2021-02-23T01:35:29.181300Z

there is no way clj-kondo analyze a dependency that has no source code...

ericdallo 2021-02-23T01:35:48.181500Z

that jar doesn't contain the source code

ericdallo 2021-02-23T01:35:58.181700Z

or there be some way to make that work with clj-kondo

mikejcusack 2021-02-23T01:40:59.181900Z

Oh, I see. It makes sense for them to do it that way though

mikejcusack 2021-02-23T01:41:58.182100Z

Again, Cursive does it so there is a way to do it.

ericdallo 2021-02-23T01:42:02.182300Z

yes, cider get the completions since use the REPL

ericdallo 2021-02-23T01:42:17.182500Z

Probably Cursive only shows when the REPL is connected

mikejcusack 2021-02-23T01:42:24.182700Z

I can test that

mikejcusack 2021-02-23T01:42:46.182900Z

It works without the REPL

ericdallo 2021-02-23T01:43:01.183100Z

We need to know if that is possible with clj-kondo too

mikejcusack 2021-02-23T01:43:17.183300Z

I wouldn't know. I haven't used the tool directly before today

mikejcusack 2021-02-23T01:43:35.183500Z

I do know that IntelliJ can decompile class files so they might be leveraging that.

ericdallo 2021-02-23T01:44:32.183700Z

@borkdude Can you help us? TL DR: clj-kondo analysis doesn't work with jars that don't have the source code, like datomic.dev-local , so clojure-lsp completion doesn't work for that, Is there any way to get that working? Cursive somehow works without a REPL

ericdallo 2021-02-23T01:44:46.183900Z

Yes, it could be that @mike.j.cusack

jumar 2021-02-23T05:39:46.186400Z

Hi, I'm considering trying clojure-lsp and I'm wondering how well it plays with Cider and possibly other packages, particularly in Spacemacs. E.g. auto-completion looks like the thing that could clash. Are you using them together? If so are there any issues? And what's your most favorite lsp feature missing in Cider that you cannot live without? πŸ™‚

ericdallo 2021-02-23T15:42:08.197400Z

Most clj-refactor features doesn't work well for me in medium/big projects

jumar 2021-02-23T20:15:09.198800Z

I use cljr-add-import-to-ns , cljr-add-require-to-ns, and cljr-add-missing-libspec all the time and they work well. But things that require whole project evaluation break - e.g. cljr-rename-symbol

ericdallo 2021-02-23T20:16:05.199Z

yeah, lsp code actions should handle the add-* πŸ™‚ and the LSP rename works perfect

borkdude 2021-02-23T08:04:42.187Z

Mine is probably this one: https://clojurians.slack.com/archives/CPABC1H61/p1613996419114800

borkdude 2021-02-23T08:05:44.188900Z

As for conflicts: I am using both but I’m not aware of any conflicts, there might be but they haven’t interrupted with my dev yet

2021-02-23T08:34:20.189100Z

I can't get over how well this all works. Seriously guys, marriage of clj-condo and lsp is the best thing since sliced bread.

πŸ‘ 3
2021-02-23T08:34:31.189500Z

Thanks @borkdude & @ericdallo

❀️ 3
borkdude 2021-02-23T08:43:10.190Z

Let's not forget @snoe, the man who started this project :)

☝️ 1
2021-02-23T08:55:39.190500Z

ah, thanks @snoe, you're the best!

ericdallo 2021-02-23T12:25:03.193600Z

@jumar Yeah, they work together, at least for doom-emacs, completion will use LSP and when Cider is on, it'll use Cider completions. You can control to use LSP completion instead of Cider with (setq lsp-enable-completion-at-point t). For more information https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide/. BTW My favorite feature are the https://clojure-lsp.github.io/clojure-lsp/features/#code-actionsπŸ™‚, especially clean-ns and add-missing-*

borkdude 2021-02-23T12:44:15.194500Z

This is probably also one of my favorites: find the definition for a local: https://twitter.com/borkdude/status/1364194077105872896

1
dpsutton 2021-02-23T15:49:04.198600Z

(for #3 there's cider-path-translations to help with that)