lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
Alex 2021-02-11T03:50:57.431900Z

Yep using lsp mode -- Thanks Eric!

pithyless 2021-02-11T11:29:24.435400Z

Is potemkin/import-vars supported by LSP? should it work by default or do I need to add something to my config? My understanding (perhaps mistaken) is that the newest clojure-lsp uses clj-kondo for analyzing references (and clj-kondo does support import-vars). Wondering if I'm missing something or if this just isn't supported right now.

borkdude 2021-02-11T11:30:28.436300Z

@pithyless clj-kondo has some support for it, but it might not be support fully yet with respect to analysis output which LSP uses. I'm wondering what your issue is?

1☝️
pithyless 2021-02-11T11:31:55.437800Z

In ns1 I've got a (import-var other-ns foo) ; and in ns2 I'm seeing unresolved-var warning when calling (ns1/foo)

borkdude 2021-02-11T11:32:12.438100Z

@pithyless that's a clj-kondo issue: https://github.com/clj-kondo/clj-kondo/issues/1167

borkdude 2021-02-11T11:32:50.439Z

the unresolved var linter is a new one which doesn't read all the necessary namespaces when it comes to potemkin, this needs a custom fix for potemkin

borkdude 2021-02-11T11:33:17.439700Z

it does work when you lint all the namespaces in one go.

borkdude 2021-02-11T11:34:10.440900Z

a workaround for now is to exclude the namespace in which you import the vars from the unresolved-var linter

pithyless 2021-02-11T11:35:19.441Z

🙏 thanks! I was going a little crazy testing different permutations (first time setting up lsp with doom-emacs).

pithyless 2021-02-11T11:37:40.442700Z

> it does work when you lint all the namespaces in one go. This has been my experience when running clj-kondo. I suppose that means flycheck (that also uses clj-kondo) was running the linter differently?

borkdude 2021-02-11T11:38:01.443100Z

no, you should see the same problem when running with flycheck I think

borkdude 2021-02-11T11:38:27.443500Z

I still run my diagnostics using flycheck, not lsp, although I do use lsp

borkdude 2021-02-11T11:38:35.443700Z

(it almost sounds like a drug, does it)

2😂
pithyless 2021-02-11T11:50:27.446Z

@borkdude I disabled lsp and enabled flycheck and can confirm that it correctly parses vars generated by import-vars; (running doom-emacs).

pithyless 2021-02-11T11:51:28.446500Z

^ dammit, PEBKAC. I take it back.

pithyless 2021-02-11T11:52:58.447Z

it looks like my flycheck config was simply not checking for unresolved-vars in other NSes

borkdude 2021-02-11T11:53:59.447700Z

you were probably running a not-up-to-date clj-kondo since this check is only there since the latest release (last month)

borkdude 2021-02-11T11:54:19.448300Z

of course you can turn it off completely if you want

pithyless 2021-02-11T11:55:52.450Z

yeah, and I think I was relying on a cider and/or clj-refactor feature (for lsp I've been testing w/o any connected repl)

borkdude 2021-02-11T11:56:43.450700Z

one question is: when you navigate to a potemkin-imported var, should you go to the importing namespace or the imported namespace (the real definition)?

pithyless 2021-02-11T11:58:07.451600Z

I think both of those answers can be considered "correct". I'd be less surprised to go to the importing NS; and from there be able to jump again to the real definitions.

pithyless 2021-02-11T12:00:22.455Z

Due to all the tooling quirks and potential issues with AOT, etc. I'm well aware of the questions raised by even using potemkin (especially since I'm wrapping it with my own custom macro that supports CLJC). But I really like the idea of separating implementation NSes from the public API and wish there was a less frowned upon approach to doing this.

pithyless 2021-02-11T12:01:10.456300Z

I've even considered just doing the busy work of copy-pasting the functions and macros - and calling out to the originals; but should I also copy the docstrings; etc?

borkdude 2021-02-11T12:01:30.457Z

What I sometimes do is use a function which just generates the code for doing this and then pasting this code in the file. This has the benefit that the tooling gets it ;)

borkdude 2021-02-11T12:02:49.457900Z

One recent example of this is https://github.com/babashka/babashka/blob/e4a96606703a1c6f3bf5177270cd5131b24a2b44/src/babashka/impl/fs.clj#L10-L16 which updates the code below between the ;; placeholder comments.

borkdude 2021-02-11T12:03:31.458300Z

and I can actually see what's going on

borkdude 2021-02-11T12:04:05.458900Z

I've been thinking of how to generalize this approach: macros/fns which update a dedicated segment in the file just below the invocation

borkdude 2021-02-11T12:04:29.459300Z

It might also be considered hacky, just fwiw ;)

pithyless 2021-02-11T12:06:20.460600Z

Thanks, I think it may be a good tradeoff 🙂

borkdude 2021-02-11T12:06:35.461Z

you could do this by just copying the docstring meta from the original vars and then writing them to the target "API" namespace

ericdallo 2021-02-11T12:20:51.462100Z

@pithyless added @borkdude suggestion to workaround this for lsp users: https://github.com/clj-kondo/clj-kondo/issues/1167#issuecomment-777413482

1
lread 2021-02-11T13:36:43.468100Z

@pithyless I am also currently doing a cljc import-vars for rewrite-clj v1. I personally like the concept in theory, but the practical costs are certainly questionable.

ericdallo 2021-02-11T13:45:31.470Z

:clojure-lsp: Released https://github.com/clojure-lsp/clojure-lsp/releases/tag/2021.02.11-12.43.06 🎉 : • Fix auto add new ns to new blank files • Add new code action: Move expression to let • Add new code action: Change collection to map, vector, list, set

5🎉
borkdude 2021-02-11T13:46:01.470500Z

This is awesome!

ericdallo 2021-02-11T13:46:28.470700Z

Thank you 😄

borkdude 2021-02-11T13:48:22.471100Z

Do you also tweet these things? I want to retweet them ;)

ericdallo 2021-02-11T13:48:59.471300Z

hahahah I don't have a twitter (yeah, I know :man-facepalming:too many social apps 😛 )

ericdallo 2021-02-11T13:49:08.471500Z

but feel free to tweet them 😄

borkdude 2021-02-11T13:49:16.471700Z

I will do it for you then

1❤️
ericdallo 2021-02-11T13:53:31.472400Z

Thank you ❤️

borkdude 2021-02-11T13:55:52.472600Z

How do I activate changing the coll type btw? I am trying cycle-coll, is that the right one?

borkdude 2021-02-11T13:56:05.472800Z

when cycling from [1 2 3] to {1 2 3} you get into an invalid state btw

borkdude 2021-02-11T13:56:11.473Z

which you cannot cycle out of

ericdallo 2021-02-11T13:56:35.473200Z

oh, it's a new one change-coll , but we already return it as a code action, so you can just lsp-execute-code-action and choose that

borkdude 2021-02-11T13:57:22.473500Z

oh nice, thanks

ericdallo 2021-02-11T13:58:44.473700Z

Also, lsp-mode show the code actions info in two possible ways: • via modeline https://emacs-lsp.github.io/lsp-mode/page/main-features/#code-actions-on-modeline • via lsp-ui (maybe too much): https://emacs-lsp.github.io/lsp-ui/#lsp-ui-sideline Personally I just enable the modeline one which is simple and works nice

ericdallo 2021-02-11T13:58:54.474Z

(it's enabled by default AFAIK in lsp-mode)

borkdude 2021-02-11T14:02:44.474300Z

oh I never paid attention to that, thanks. I think I'll just use M-x though

1👍
dharrigan 2021-02-11T14:02:59.474700Z

Hmmm

borkdude 2021-02-11T14:03:20.475Z

which is more keystrokes than making the actual change myself ;)

dharrigan 2021-02-11T14:04:23.475400Z

Just trying it out, and there' weirdness with Vim going on

dharrigan 2021-02-11T14:04:35.475700Z

How do you record screens so I can show?

ericdallo 2021-02-11T14:06:59.476100Z

I use https://github.com/phw/peek

dharrigan 2021-02-11T14:07:22.476400Z

kk

dharrigan 2021-02-11T14:10:49.476900Z

righty, let's try this...

dharrigan 2021-02-11T14:10:58.477Z

ericdallo 2021-02-11T14:11:35.477600Z

oh, that's odd, let me try in emacs

ericdallo 2021-02-11T14:16:39.478Z

it works in emacs 😕

borkdude 2021-02-11T14:18:21.478500Z

you hear it, you should switch to emacs then

1😂1😱
dharrigan 2021-02-11T14:20:52.479Z

Errrrrr....no 😛

ericdallo 2021-02-11T14:25:01.479500Z

@dharrigan to debug that you can check what the vim client is sending as the position params

dharrigan 2021-02-11T14:25:11.479700Z

Just doing that

dharrigan 2021-02-11T14:25:19.479900Z

waaay ahead of you 🙂

1😂
dharrigan 2021-02-11T14:28:19.480300Z

[Trace - 14:27:39] Sending request 'workspace/executeCommand - (3)'.
Params: {
    "command": "change-coll",
    "arguments": [
        "file:///home/david/foo.clj",
        0,
        0,
        "set"
    ]
}

dharrigan 2021-02-11T14:28:36.480500Z

line 0, position 0

borkdude 2021-02-11T14:28:42.480700Z

Looks wrong to me

borkdude 2021-02-11T14:29:20.480900Z

@dharrigan Can you try again with the cursor exactly on the first character of the coll?

ericdallo 2021-02-11T14:29:49.481100Z

Yeah, ☝️ line 0, col 0 is really wrong

dharrigan 2021-02-11T14:29:54.481300Z

same

dharrigan 2021-02-11T14:30:03.481500Z

let's try inside

dharrigan 2021-02-11T14:30:32.481700Z

same

ericdallo 2021-02-11T14:30:37.481900Z

Could you confirm other code actions/refactor commands send correct position?

dharrigan 2021-02-11T14:30:53.482100Z

okay, let's try rename

ericdallo 2021-02-11T14:32:01.482400Z

oh, check the code action that is being returned from server, where reurn the position to client send on that request

borkdude 2021-02-11T14:32:30.483100Z

@lee @pithyless thinking more about this, seeing what's in the latest release, maybe "create API namespace" could even be an LSP code action

dharrigan 2021-02-11T14:33:42.483200Z

hmm, that's not working now either

dharrigan 2021-02-11T14:33:49.483400Z

rename isn't renaming

borkdude 2021-02-11T14:34:20.483600Z

try a restart?

dharrigan 2021-02-11T14:34:32.483800Z

Playing around...

ericdallo 2021-02-11T14:35:43.484Z

Probably a bug introduced on coc ?

ericdallo 2021-02-11T14:38:47.484200Z

:thinking_face: I don't get it, what should this action do exactly?

ericdallo 2021-02-11T14:39:09.484400Z

a ns for an API that uses potemkin?

borkdude 2021-02-11T14:40:30.484600Z

This would replace potemkin by just generating the code: copying the docstrings of the other var and just proxying the args to the other var

borkdude 2021-02-11T14:41:31.484800Z

Just an import-var action could also work

borkdude 2021-02-11T14:41:56.485100Z

This is probably something that should need some hammock time

ericdallo 2021-02-11T14:42:07.485300Z

oh, seems helpful but probably a huge action

ericdallo 2021-02-11T14:42:51.485500Z

but yeah, I would like to add those kind of actions, it'd be even better to use kondo analysis to know if user has potemkin and suggest that kind of action

borkdude 2021-02-11T14:42:53.485700Z

The information is basically already there in the kondo analysis

borkdude 2021-02-11T14:43:08.485900Z

no, a user would NOT use potemkin anymore

borkdude 2021-02-11T14:43:14.486100Z

this is what we would like to get rid off

ericdallo 2021-02-11T14:43:36.486800Z

oh yeah, got it, I was just wondering when show that action so

borkdude 2021-02-11T14:44:01.487500Z

So when you say: import-var foo/bar, you generate a function:

(defn bar "<docstring>" [x]
  (foo/bar x))

ericdallo 2021-02-11T14:44:03.487800Z

what is the requirement to show that? like ,for change coll, we only return that action when cursor is in a coll

ericdallo 2021-02-11T14:44:26.488200Z

yeah, that's probably not hard

ericdallo 2021-02-11T14:44:32.488500Z

we already have all that info

ericdallo 2021-02-11T14:44:45.489Z

kondo is our life saver 😛

borkdude 2021-02-11T14:45:38.489900Z

Maybe show it when the user types foo/bar and hovers this?

borkdude 2021-02-11T14:46:08.490700Z

This would make clj-kondo's life easier as well

borkdude 2021-02-11T14:46:13.490900Z

and this would work for both CLJ and CLJS

ericdallo 2021-02-11T14:46:35.491300Z

yeah, it makes sense, a detailed repro would be really helpful though

dharrigan 2021-02-11T14:47:26.492400Z

[Trace - 14:46:51] Sending request 'textDocument/rename - (37)'.
Params: {
    "textDocument": {
        "uri": "file:///home/david/foo.clj"
    },
    "position": {
        "line": 6,
        "character": 6
    },
    "newName": "foos"
}


[Trace - 14:46:51] Received response 'textDocument/rename - (37)' in 1ms.
No result returned.

dharrigan 2021-02-11T14:47:41.492800Z

Why would clojure-lsp not honour a rename request?

ericdallo 2021-02-11T14:47:50.493Z

rename request is a different thing

ericdallo 2021-02-11T14:47:58.493400Z

is not a workspace/executeCommand

lread 2021-02-11T14:48:20.493900Z

I am thinking of maybe leaving my import-vars in my code but wrapping it in an #_ and then have a build step see that and insert/update generated shims. I have a variant of import-vars that also renames.

ericdallo 2021-02-11T14:48:34.494100Z

I think the bug will happen for every workspace/executeCommand (move-to-let, clean-ns, cycle-coll, introduce-let, inline-symbol, etc)

2021-02-11T14:48:47.494300Z

Wow this is amazing (well, except for the part that doesn't work but that is a smail detail 😅), how do you get that menu?

pithyless 2021-02-11T14:52:37.498100Z

import-vars as a lsp action sounds like a great compromise; although I would suggest generating code using meta arglists syntax (better support for custom macros and multiple cardinality). Renaming would also be easy - someone could literally just change the new var after the action and leave the rest of the code unchanged.

pithyless 2021-02-11T14:57:06.001900Z

Only diff from potemkin and @lee’s approach is that an lsp action is a one-time event (docstring etc won’t update automatically).

borkdude 2021-02-11T14:59:11.004900Z

yeah, I'm thinking of some action I've got in VSCode markdown where you can update a table.

borkdude 2021-02-11T14:59:21.005200Z

so you could also have update-imported-var

pithyless 2021-02-11T14:59:28.005600Z

OTOH, if you’d like to change something (docstring, additional cardinality, pre/post assertions, etc) you’ve got easy to work with code and no need to expand some macro or build step with new functionality

borkdude 2021-02-11T14:59:30.005800Z

or update-imported-vars

borkdude 2021-02-11T15:00:08.006Z

maybe the imported var could have some metadata or annotation (like clj-kondo's #_:clj-kondo/ignore to signal that it was imported and can potentially be synced

lread 2021-02-11T15:00:48.006900Z

yeah, a marker would make sense if resync is of interest

borkdude 2021-02-11T15:01:48.008Z

it's almost just like a template

borkdude 2021-02-11T15:02:06.008200Z

foo.bar.api.template.clj and then fill in the blanks

lread 2021-02-11T15:05:17.009500Z

hmmm... template idea does seem simpler than updating in place.

lread 2021-02-11T15:07:42.011800Z

for me, I’ll be importing without change (well except for my renames at import time), but @pithyless does have the use case of importing then changing.

dharrigan 2021-02-11T15:14:51.013700Z

Should clojure-lsp be running clj-kondo on startup?

dharrigan 2021-02-11T15:15:00.013900Z

to analyse the file(s)?

ericdallo 2021-02-11T15:16:17.014100Z

yes, but it uses clj-kondo via JVM API

ericdallo 2021-02-11T15:16:20.014300Z

Why?

dharrigan 2021-02-11T15:16:22.014500Z

I'm getting this

dharrigan 2021-02-11T15:16:24.014700Z

02-11T15:14:06.753Z daffy WARN [clojure-lsp.db:45] - Could not load db path to '/home/david/tmp/foo/.lsp/sqlite.db': '/home/david/tmp/foo/.lsp' does not exist
2021-02-11T15:14:06.754Z daffy INFO [clojure-lsp.crawler:138] - Paths analyzed, took 0.001144411 secs. Caching for next startups...
2021-02-11T15:14:06.757Z daffy INFO [clojure-lsp.main:342] - Initialized
2021-02-11T15:14:30.932Z daffy INFO [clojure-lsp.main:396] - Starting server...
2021-02-11T15:14:30.935Z daffy DEBUG [clojure-lsp.nrepl:24] - nrepl not found, skipping nrepl server start...
2021-02-11T15:14:30.938Z daffy INFO [clojure-lsp.main:303] - Initializing...
2021-02-11T15:14:31.027Z daffy WARN [clojure-lsp.db:45] - Could not load db [SQLITE_ERROR] SQL error or missing database (no such table: project)
2021-02-11T15:14:31.028Z daffy INFO [clojure-lsp.crawler:138] - Paths analyzed, took 0.001078665 secs. Caching for next startups...
2021-02-11T15:14:31.031Z daffy INFO [clojure-lsp.main:342] - Initialized
2021-02-11T15:15:27.645Z daffy INFO [clojure-lsp.main:396] - Starting server...
2021-02-11T15:15:27.648Z daffy DEBUG [clojure-lsp.nrepl:24] - nrepl not found, skipping nrepl server start...
2021-02-11T15:15:27.652Z daffy INFO [clojure-lsp.main:303] - Initializing...
2021-02-11T15:15:27.742Z daffy WARN [clojure-lsp.db:45] - Could not load db [SQLITE_ERROR] SQL error or missing database (no such table: project)
2021-02-11T15:15:27.743Z daffy INFO [clojure-lsp.crawler:138] - Paths analyzed, took 0.001129293 secs. Caching for next startups...
2021-02-11T15:15:27.746Z daffy INFO [clojure-lsp.main:342] - Initialized

dharrigan 2021-02-11T15:16:31.014900Z

so I created the .lsp directory

dharrigan 2021-02-11T15:16:44.015100Z

and the sqlite.db is 0 bytes in size

dharrigan 2021-02-11T15:17:13.015300Z

I'm still trying to figure out why it's not doing the cocaction and the rename

ericdallo 2021-02-11T15:17:28.015500Z

it should create the dir and the file when starting, and only after all analyzer it should add to the file

dharrigan 2021-02-11T15:18:14.015700Z

nope

dharrigan 2021-02-11T15:18:17.015900Z

it's not creating the dir

dharrigan 2021-02-11T15:18:23.016100Z

interesting

ericdallo 2021-02-11T15:19:51.016300Z

:thinking_face: it creates for me

ericdallo 2021-02-11T15:20:02.016500Z

it's clojure-lsp responsibility to create that

dharrigan 2021-02-11T15:20:12.016700Z

All I can report is what I see

dharrigan 2021-02-11T15:20:46.016900Z

❯ rm /tmp/clojure-lsp.out && tail -F /tmp/clojure-lsp.out
tail: cannot open '/tmp/clojure-lsp.out' for reading: No such file or directory
tail: '/tmp/clojure-lsp.out' has appeared;  following new file
2021-02-11T15:19:54.091Z daffy INFO [clojure-lsp.main:396] - Starting server...
2021-02-11T15:19:54.093Z daffy DEBUG [clojure-lsp.nrepl:24] - nrepl not found, skipping nrepl server start...
2021-02-11T15:19:54.097Z daffy INFO [clojure-lsp.main:303] - Initializing...
2021-02-11T15:19:54.107Z daffy WARN [clojure-lsp.db:45] - Could not load db path to '/home/david/bob/foo/.lsp/sqlite.db': '/home/david/bob/foo/.lsp' does not exist
2021-02-11T15:19:54.109Z daffy INFO [clojure-lsp.crawler:138] - Paths analyzed, took 0.001491572 secs. Caching for next startups...
2021-02-11T15:19:54.112Z daffy INFO [clojure-lsp.main:342] - Initialized

dharrigan 2021-02-11T15:20:56.017100Z

  ~/bob/foo                                                                                                                                                                                                                                                 
❯ ls -la
total 12
drwxr-xr-x 2 david david 4096 Feb 11 15:19 .
drwxr-xr-x 3 david david 4096 Feb 11 15:19 ..
-rw-r--r-- 1 david david   36 Feb 11 15:19 foo.clj

dharrigan 2021-02-11T15:21:02.017300Z

no .lsp directory

dharrigan 2021-02-11T15:23:40.017500Z

Another issue too

dharrigan 2021-02-11T15:23:41.017700Z

2021-02-11T15:23:30.027Z daffy ERROR [clojure-lsp.main:?] - 
com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine      PosixJavaThreads.java:  192
            com.oracle.svm.core.thread.JavaThreads.threadStartRoutine           JavaThreads.java:  519
                        java.util.concurrent.ForkJoinWorkerThread.run  ForkJoinWorkerThread.java:  183
                          java.util.concurrent.ForkJoinPool.runWorker          ForkJoinPool.java: 1594
                               java.util.concurrent.ForkJoinPool.scan          ForkJoinPool.java: 1656
             java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec          ForkJoinPool.java: 1020
                             java.util.concurrent.ForkJoinTask.doExec          ForkJoinTask.java:  290
              java.util.concurrent.CompletableFuture$AsyncSupply.exec     CompletableFuture.java: 1692
               java.util.concurrent.CompletableFuture$AsyncSupply.run     CompletableFuture.java: 1700
                    clojure-lsp.main.LSPTextDocumentService/reify/get                   main.clj:  150
                                      clojure-lsp.handlers/completion               handlers.clj:  107
                            clojure-lsp.feature.completion/completion             completion.clj:  203
                                               clojure.core/namespace                   core.clj: 1599
java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.Named

dharrigan 2021-02-11T15:24:36.017900Z

I have this mapping

dharrigan 2021-02-11T15:24:55.018100Z

nmap <silent> <Leader>act <Plug>(coc-codeaction)

dharrigan 2021-02-11T15:25:13.018400Z

It would be interesting to know if it works for you

ericdallo 2021-02-11T15:26:55.018600Z

That issue with completion is a bug, please open a issue related to that with some repro check the process stderr too about, it's odd that is not creating the .lsp dir

pithyless 2021-02-11T15:28:11.019900Z

I’m interested mainly in importing once; it’s also nice to serve as a template that I can rename or change afterwards. I just wanted to mention this is different than how potemkin works now, since others may be dependent on the sync behavior.

2021-02-11T15:32:33.020100Z

It sort of works but it's only showing clean namespace

2021-02-11T15:33:47.020500Z

Oh, there is an update on clojure-lsp (I'm on arch linux, so thank you for maintaining lots of clojure related packages!)

2021-02-11T15:33:52.020700Z

Let me try after the update.

ericdallo 2021-02-11T15:33:55.020900Z

I tested it and for me after removing the .lsp folder, it creates it correctly after the startup log:

2021-02-11T15:32:39.261Z gregnix-nubank INFO [clojure-lsp.main:396] - Starting server...                                                                                                      
2021-02-11T15:32:39.399Z gregnix-nubank DEBUG [clojure-lsp.nrepl:24] - nrepl not found, skipping nrepl server start...                                                                        
2021-02-11T15:32:39.439Z gregnix-nubank INFO [clojure-lsp.main:303] - Initializing...                                                                                                         
2021-02-11T15:32:39.568Z gregnix-nubank WARN [clojure-lsp.db:45] - Could not load db path to '/home/greg/dev/clojure-lsp/.lsp/sqlite.db': '/home/greg/dev/clojure-lsp/.lsp' does not exist    
2021-02-11T15:32:41.086Z gregnix-nubank INFO [clojure-lsp.crawler:87] - Analyzing 125 paths with clj-kondo with batch size of 3 ...                                                           
2021-02-11T15:32:41.087Z gregnix-nubank INFO [clojure-lsp.crawler:93] - Analyzing 1/3 batch paths with clj-kondo...                                                                           
2021-02-11T15:32:49.678Z gregnix-nubank INFO [clojure-lsp.crawler:93] - Analyzing 2/3 batch paths with clj-kondo...                                                                           
2021-02-11T15:33:01.747Z gregnix-nubank INFO [clojure-lsp.crawler:93] - Analyzing 3/3 batch paths with clj-kondo...                                                                           
2021-02-11T15:33:02.846Z gregnix-nubank INFO [clojure-lsp.crawler:138] - Paths analyzed, took 21.760649 secs. Caching for next startups...                                                    
2021-02-11T15:33:03.182Z gregnix-nubank INFO [clojure-lsp.crawler:167] - Manual GC after classpath scan took 0.11262293 seconds
2021-02-11T15:33:05.913Z gregnix-nubank INFO [clojure-lsp.crawler:138] - Paths analyzed, took 1.1907887 secs. Caching for next startups...

2021-02-11T15:33:56.021100Z

Seem to be fine with the built in nvim lsp

1
dharrigan 2021-02-11T15:35:05.021400Z

Did you try with a single file?

dharrigan 2021-02-11T15:35:15.021600Z

I mean a directory with only one clj file in it?

ericdallo 2021-02-11T15:35:30.021800Z

oh, that's the reason

dharrigan 2021-02-11T15:35:48.022Z

For I can reproduce this every time, but with one of my projects with hundreds of iles, it creates the .lsp directory and sqlite db

2021-02-11T15:35:50.022200Z

That and an empty deps.edn

ericdallo 2021-02-11T15:35:52.022400Z

we don't persist okndo analysis for non projects, since we don't have a project root

ericdallo 2021-02-11T15:36:20.022600Z

when the project has a deps/project/boot file, it's considered a project on most clients

ericdallo 2021-02-11T15:36:29.022800Z

but a single clojure file in afolder it is not

dharrigan 2021-02-11T15:36:41.023100Z

would that affect the cocactions?

2021-02-11T15:36:59.023400Z

So I can see the change collection but got the same result as you, it changes the ns declaration.

ericdallo 2021-02-11T15:37:09.023600Z

only the add-missing-* probably

dharrigan 2021-02-11T15:37:38.023800Z

hmm, okay, then I'm still at a mystery of why cocactions doesn' work. I probably need another independent source to verify

ericdallo 2021-02-11T15:38:40.024Z

just tested a single /tmp/clojure-test.clj file and the code actions works as expected

dharrigan 2021-02-11T15:39:01.024200Z

but on emacs?

ericdallo 2021-02-11T15:39:02.024400Z

also the .lsp folder is not created as expected as well

dharrigan 2021-02-11T15:39:03.024600Z

not vim

ericdallo 2021-02-11T15:39:04.024800Z

yes

dharrigan 2021-02-11T15:39:11.025Z

yeah, I need a vim source 🙂

ericdallo 2021-02-11T15:39:26.025200Z

Maybe @rafaeldelboni can test it too?

dharrigan 2021-02-11T15:40:34.025400Z

Ah

dharrigan 2021-02-11T15:40:38.025600Z

Someone else verified it

dharrigan 2021-02-11T15:40:59.026100Z

Thank you

dharrigan 2021-02-11T15:41:10.026300Z

So, <shrug> something broken somewhere

ericdallo 2021-02-11T15:41:45.026500Z

yeah, I'll double check clojure-lsp side, but probably a vim client bug

ericdallo 2021-02-11T15:42:07.026700Z

would be helpful if you could provide the lsp logs of the return of textDocument/codeActions

ericdallo 2021-02-11T15:42:26.026900Z

where shows all available code actions (and the data field, that's what I want)

dharrigan 2021-02-11T15:42:34.027100Z

kk, I'll raise a bug on this, even though I completely understand it may not be a clojure-lsp issue

dharrigan 2021-02-11T15:42:41.027300Z

but hard to track here on slack

1
dharrigan 2021-02-11T15:42:49.027600Z

kk

rafaeldelboni 2021-02-11T15:58:49.027900Z

About the .lsp folder?

dharrigan 2021-02-11T15:59:02.028100Z

no, that's been solved

dharrigan 2021-02-11T15:59:03.028300Z

🙂

dharrigan 2021-02-11T15:59:08.028500Z

it's about the coc-codeactions

dharrigan 2021-02-11T15:59:23.028700Z

just filing a bug right now

rafaeldelboni 2021-02-11T16:01:30.028900Z

I have the same behavior as you

dharrigan 2021-02-11T16:01:49.029100Z

https://github.com/clojure-lsp/clojure-lsp/issues/311

ericdallo 2021-02-11T16:02:24.029400Z

thanks!

dharrigan 2021-02-11T16:02:35.029600Z

we'll get to the bottom of this for sure! 🙂

1😃
lread 2021-02-11T16:04:18.029900Z

oh yeah… forgot… my import-vars variant can also modify docstrings… I might just go ahead and experiment with the template idea…

rafaeldelboni 2021-02-11T16:22:43.030100Z

@dharrigan how you enable debug to show the coc commands in the logs?

dharrigan 2021-02-11T16:25:06.030300Z

I have this is my settting:

dharrigan 2021-02-11T16:25:24.030500Z

<https://the.wepl.blog/>

rafaeldelboni 2021-02-11T16:26:01.030700Z

this? "trace.server": "verbose",

dharrigan 2021-02-11T16:26:03.030900Z

then I do, in vim :CocCommand workspace.showOutput

dharrigan 2021-02-11T16:26:07.031100Z

Yes

pithyless 2021-02-11T16:35:33.034500Z

> Move expression to let Works really nice; but for some reason I can't get LSP rename to work (either on a let binding or top-level var). I get a popup Rename foo to: ... but after changing the name and hitting enter - nothing happens. I also don't see anything relevant in *lsp-log* or *clojure-lsp*; any suggestions on how to debug this in emacs?

pithyless 2021-02-12T16:55:23.131200Z

sure, I'll try to setup a minimal repro after the weekend

1👍
ericdallo 2021-02-11T16:36:09.034600Z

could you check /tmp/clojure-lsp.out?

ericdallo 2021-02-11T16:37:03.034800Z

any exception or any log on that file after you try to rename?

rafaeldelboni 2021-02-11T16:39:53.035300Z

How is responsible to build the action menu? The menu is arriving wrong here with line and column zero

pithyless 2021-02-11T16:40:06.035700Z

DEBUG [clojure-lsp.main:?] - :documentHighlight 0 clojure.lang.LazySeq@58bd0ac2
DEBUG [clojure-lsp.main:?] - :hover 0 clojure.lang.LazySeq@2a49da2b
DEBUG [clojure-lsp.main:?] - :documentHighlight 0 clojure.lang.LazySeq@2a9574c7
DEBUG [clojure-lsp.main:?] - :documentHighlight 0 clojure.lang.LazySeq@eb12ea9f
DEBUG [clojure-lsp.main:?] - :hover 0 clojure.lang.LazySeq@4eddda28

pithyless 2021-02-11T16:40:19.035900Z

doesn't look like it

rafaeldelboni 2021-02-11T16:41:26.036100Z

Oh I just saw the comments in the issue, sorry

1
ericdallo 2021-02-11T16:41:47.036300Z

yeah, what are you trying to rename?

pithyless 2021-02-11T16:42:13.036500Z

(defn foo []
  (let [a (+ 3 3)
        new-binding (+ 3 3 4)]
    new-binding))
tried to rename foo and new-binding

ericdallo 2021-02-11T16:43:25.036700Z

yeah, it should work, what clojure-lsp version are you using?

ericdallo 2021-02-11T16:43:35.036900Z

clojure-lsp --version

pithyless 2021-02-11T16:43:47.037100Z

clojure-lsp 2021.02.11-12.43.06

pithyless 2021-02-11T16:45:37.037400Z

@ericdallo can I easily repro the case via the CLI? (to rule out the clojure-lsp?)

pithyless 2021-02-11T16:46:27.037600Z

GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G6042)) of 2021-02-08

ericdallo 2021-02-11T16:46:28.037800Z

ATM there is no way to use clojure-lsp via terminal 😅

ericdallo 2021-02-11T16:46:53.038Z

oh, make sure you have a updated lsp-mode

pithyless 2021-02-11T16:51:15.038300Z

turns out lsp-mode was up-to-date, but I did end up bumping all my doom packages 😅

pithyless 2021-02-11T16:51:22.038500Z

either way, no dice

ericdallo 2021-02-11T16:53:40.038700Z

that's weird, you can open a issue on clojure-lsp with a repro and more information

Matsu 2021-02-11T19:45:34.039500Z

Should clojure-lsp support autocompletion for only the clojure.core functions or also function :require'd into the namespace?

Matsu 2021-02-11T19:46:20.040300Z

Currently setting up and environment with neovim 0.5 lsp, https://github.com/nvim-lua/completion-nvim and clojure-lsp and don't seem to get any other autocompletes than those

ericdallo 2021-02-11T19:48:20.041200Z

it should work for both @matias287 , but we still have a issue when completing non valid clojure code

ericdallo 2021-02-11T19:48:26.041300Z

Check here for more info: https://github.com/clojure-lsp/clojure-lsp/issues/270

Matsu 2021-02-11T19:48:42.041600Z

Cheers. I'll check it out

Matsu 2021-02-11T19:49:39.041800Z

My current situtation is that core gets filled:

Matsu 2021-02-11T19:49:45.042200Z

But others don't

Matsu 2021-02-11T19:51:16.042600Z

But yeah nice to see it's already under discussion 🙂

benedek 2021-02-11T19:53:10.044Z

change collection is also available in emacs clojure mode. would be interesting exercise to compare clj and elisp impl

ericdallo 2021-02-11T19:54:18.044100Z

str/sp should work like it works for emacs

ericdallo 2021-02-11T19:54:35.044600Z

Matsu 2021-02-11T19:55:55.045Z

Hmm that's weird

Matsu 2021-02-11T19:56:31.045200Z

I wonder why it's not displaying it with nvim

ericdallo 2021-02-11T19:56:44.045400Z

can you check your /tmp/clojure-lsp.out if there is any exception or something rellevant

ericdallo 2021-02-11T19:57:45.045600Z

Yeah, since clojure-lsp is a server this feature could be used in Calva VSCode and vim for example

ericdallo 2021-02-11T19:58:15.045800Z

for emacs users, they could choose one or other or just trust on lsp code actions and forget about the cycle colls keybindings from clojure-mode 😄

benedek 2021-02-11T19:59:45.046200Z

yup ofc i am aware this impl pushes this feature up for a wider audience. that is cool ofc

benedek 2021-02-11T20:00:11.046400Z

🙇

Matsu 2021-02-11T20:00:19.046600Z

It doesn't seem to print anything when I write (string/spl) but it does output this when I'm writing the string part of a simple (println "hello world")

Matsu 2021-02-11T20:00:22.046800Z

2021-02-11T19:59:34.608Z Rainfall ERROR [clojure-lsp.main:?] -
com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine      PosixJavaThreads.java:  192
            com.oracle.svm.core.thread.JavaThreads.threadStartRoutine           JavaThreads.java:  519
                        java.util.concurrent.ForkJoinWorkerThread.run  ForkJoinWorkerThread.java:  183
                          java.util.concurrent.ForkJoinPool.runWorker          ForkJoinPool.java: 1594
                               java.util.concurrent.ForkJoinPool.scan          ForkJoinPool.java: 1656
             java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec          ForkJoinPool.java: 1020
                             java.util.concurrent.ForkJoinTask.doExec          ForkJoinTask.java:  290
              java.util.concurrent.CompletableFuture$AsyncSupply.exec     CompletableFuture.java: 1692
               java.util.concurrent.CompletableFuture$AsyncSupply.run     CompletableFuture.java: 1700
                    clojure-lsp.main.LSPTextDocumentService/reify/get                   main.clj:  150
                                      clojure-lsp.handlers/completion               handlers.clj:  107
                            clojure-lsp.feature.completion/completion             completion.clj:  203
                                               clojure.core/namespace                   core.clj: 1599
java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Named

ericdallo 2021-02-11T20:01:09.047Z

😉

ericdallo 2021-02-11T20:02:28.047300Z

This is other issue fixed on next release: https://github.com/clojure-lsp/clojure-lsp/issues/310

Matsu 2021-02-11T20:03:06.047600Z

Ahh gotchu. But yeah, no output into the file on the string/sp part.

ericdallo 2021-02-11T20:03:16.047800Z

Alright, so to debug this we would need info about lsp request reponse

ericdallo 2021-02-11T20:05:18.048Z

Could you please open a issue following the bug report? then we can track the issue

Matsu 2021-02-11T20:05:56.048200Z

Sure!

Matsu 2021-02-11T20:10:40.048400Z

Should the autocomplete kick in at this point too? Offering snippets like clojure.string etc? If so, should I write that into the same ticket?

ericdallo 2021-02-11T20:11:07.048800Z

We don't have this feature yet, but it's a nice enhancement 🙂

ericdallo 2021-02-11T20:11:24.049Z

You should open a different one, a feature request

Matsu 2021-02-11T20:12:36.049200Z

Sure thing! 🙂

Steven Deobald 2021-02-11T22:44:23.050700Z

Is it normal for lsp/kondo to complain about (:require [clojure.test :refer :all]) ? I write all my tests this way so it would be nice to deactivate that complaint ... or even nicer if lsp/kondo understood that use-fixtures, deftest, and testing are all definitely resolved symbols.

borkdude 2021-02-11T22:45:28.051300Z

@steven427 You can turn this off, but clj-kondo might have trouble resolving those vars to the correct namespace if you have multiple :refer :alls

borkdude 2021-02-11T22:45:51.051500Z

See https://github.com/borkdude/clj-kondo/blob/master/doc/linters.md for more details.

1☝️
borkdude 2021-02-11T22:48:00.052400Z

E.g. this works without problems:

(require '[clojure.test :refer :all])

use-fixtures

(deftest foo (testing (is 1)))

borkdude 2021-02-11T22:48:07.052600Z

(or at least on my machine)

Steven Deobald 2021-02-11T22:48:40.052800Z

clojure.test should be the only :refer :all ever, I think.

borkdude 2021-02-11T22:48:58.053100Z

You can configure this.

Steven Deobald 2021-02-11T22:49:43.054Z

Am I configuring kondo to ignore it entirely? Or configuring it to parse :all correctly?

borkdude 2021-02-11T22:50:03.054400Z

Configure it to don't trigger a warning for clojure.test

Steven Deobald 2021-02-11T22:52:30.055700Z

Ah, sorry. Just saw :refer-all ... haven't written Clojure in about 6 years and wasn't familiar with that. Switching to it doesn't seem to convince kondo/lsp that those symbols exist, though.

borkdude 2021-02-11T22:53:11.056100Z

That should work. Can you make a tiny repro of your code?

borkdude 2021-02-11T22:53:47.056400Z

E.g. the code that I pasted above works for me. Not for you?

Steven Deobald 2021-02-11T22:55:46.057500Z

Sure, let me try. lsp also isn't inserting missing requires it's suggesting, so it's possible my setup is misconfigured for ns-macro stuff.

Steven Deobald 2021-02-11T22:58:52.057900Z

Your 3 lines break for me as well, so I'm guessing it's something I've configured strangely. I'll poke around a bit.

borkdude 2021-02-11T23:00:30.058900Z

If you can reproduce this with only clj-kondo e.g. using the binary on the command line, feel free to post an issue in the #clj-kondo or on Github. Else it might be something in LSP. I"m afk now ... 💤

ericdallo 2021-02-11T23:01:44.059400Z

Yeah, I don't think it's a issue, probably missing clj-kondo config

Steven Deobald 2021-02-11T23:01:49.059600Z

Sounds good. Thanks for the pointers.

borkdude 2021-02-11T23:02:04.059900Z

This doesn't need a config, since clojure.test is built into clj-kondo.

Steven Deobald 2021-02-11T23:02:50.061500Z

@ericdallo Is there any assumption that I'd configure clj-kondo baked into an lsp-clojure install? Because I don't use clj-kondo otherwise and I have no custom configuration whatsoever. 🙂

borkdude 2021-02-11T23:03:04.061900Z

The only case where this could go wrong is if you have linted a namespace named clojure.test which would have overwritten the analysis information that is built-in clj-kondo.

Steven Deobald 2021-02-11T23:03:36.062600Z

I'm quite certain I didn't do that but weirder things have happened.

borkdude 2021-02-11T23:03:43.062900Z

so if you accidentally typed (ns clojure.test) this might have happened

ericdallo 2021-02-11T23:04:17.063500Z

it's kind of confusing to me what is your issue

borkdude 2021-02-11T23:04:37.064Z

@steven427 To be sure, you can wipe out .clj-kondo/.cache

1👍
Steven Deobald 2021-02-11T23:06:19.065200Z

I don't seem to have a .clj-kondo/.cache anywhere... should kondo or lsp have created it on my behalf?

ericdallo 2021-02-11T23:06:51.065700Z

if you are running clojure-lsp in a project, it should create in your-project/.clj-kondo/.cache

Steven Deobald 2021-02-11T23:07:28.066600Z

Hm, nope.

borkdude 2021-02-11T23:07:30.066700Z

Are you sure you are even running clj-kondo and not another linter? Just checking...

borkdude 2021-02-11T23:08:02.067500Z

(I've had this before)

Steven Deobald 2021-02-11T23:08:21.068Z

Honestly, no idea. This is a pretty vanilla lsp-clojure install, save a few :custom settings.

ericdallo 2021-02-11T23:08:24.068200Z

Please follow the clojure-lsp Github new issue template to check everything is working, client-server logs, lsp logs, editor, version etc

Steven Deobald 2021-02-11T23:08:40.068300Z

(use-package lsp-mode
  :hook ((clojure-mode . lsp)
         (clojurec-mode . lsp)
         (clojurescript-mode . lsp))
  :config
  ;; add paths to your local installation of project mgmt tools, like lein
  (setenv "PATH" (concat "/usr/local/bin" path-separator (getenv "PATH")))
  (dolist (m '(clojure-mode
               clojurec-mode
               clojurescript-mode
               clojurex-mode))
    (add-to-list 'lsp-language-id-configuration `(,m . "clojure")))

  ;; Optional: In case `clojure-lsp` is not in your PATH
  (setq lsp-clojure-server-command '("bash" "-c" "clojure-lsp"))

  :custom
  (lsp-auto-guess-root t)
  (lsp-eldoc-enable-hover nil)
  (lsp-enable-file-watchers nil)
  (lsp-enable-folding nil)
  (lsp-headerline-breadcrumb-enable nil)
  (lsp-idle-delay .01)
  (lsp-keymap-prefix nil)
  (lsp-session-file (me/cache-concat "lsp/session.eld")))

Steven Deobald 2021-02-11T23:08:52.068600Z

(Sorry for the mess)

Steven Deobald 2021-02-11T23:09:27.068900Z

Thanks, I'll have a look

borkdude 2021-02-11T23:10:45.069300Z

Oh, I can reproduce this when I enable lsp-diagnostics.

Steven Deobald 2021-02-11T23:11:38.070700Z

Oh.

borkdude 2021-02-11T23:11:40.070800Z

So I guess @ericdallo can take it from here, I'll be asleep now. It's definitely an LSP related problem, can't reproduce with clj-kondo itself.

Steven Deobald 2021-02-11T23:12:13.071400Z

I'll try disabling lsp-diagnostics, I've also got flycheck turned on and I think I saw you mention above that they conflict.

ericdallo 2021-02-11T23:12:14.071500Z

thanks for the help @borkdude

ericdallo 2021-02-11T23:12:37.071600Z

lsp-diagnostics use flycheck

ericdallo 2021-02-11T23:12:57.071800Z

Not sure you should disable it unless you want to use clj-kondo linter manually or any other linter

ericdallo 2021-02-11T23:16:18.073800Z

so, for me this works:

(ns foo
  (:require [clojure.test :refer :all]))

deftest
and this not:
(ns foo
  (require '[clojure.test :refer :all]))

deftest
but seems correct to me as the first one is using :require and the other the function require

borkdude 2021-02-11T23:16:54.074100Z

This should also work:

(require '[clojure.test :refer :all]
         '[clojure.string :refer :all])

use-fixtures

borkdude 2021-02-11T23:17:35.074400Z

but that's not the problem, it doesn't work in both cases

Steven Deobald 2021-02-11T23:17:39.074500Z

Hmm. I've got flycheck-clj-kondo enabled on clojure-mode ... will they conflict?

borkdude 2021-02-11T23:18:12.074700Z

If you are using flycheck-clj-kondo you can turn off lsp-diagnostics

1👍
borkdude 2021-02-11T23:18:35.075200Z

flycheck-clj-kondo will assume you have clj-kondo installed on your system

ericdallo 2021-02-11T23:18:46.075800Z

oh, both cases? yeah, looks odd, please open an issue with a repro @steven427

Steven Deobald 2021-02-11T23:19:17.076400Z

Is there a safe way to bounce the clojure-lsp server from within emacs on these sorts of config changes? Or should I just restart emacs so I know I'm starting with a clean slate, state-wise?

Steven Deobald 2021-02-11T23:19:40.076500Z

Okay

ericdallo 2021-02-11T23:20:21.077Z

lsp-workspace-restart should be enough

Steven Deobald 2021-02-11T23:25:29.078100Z

Strange. @ericdallo Is there any value in testing a manual install of clj-kondo instead of letting clojure-lsp do it behind the scenes?

ericdallo 2021-02-11T23:26:31.078200Z

for debugging purposes, you can check if using only clj-kondo it works

ericdallo 2021-02-11T23:26:42.078400Z

if it works, then the issue may be in clojure-lsp

ericdallo 2021-02-11T23:26:50.078600Z

if not, is a clj-kondo config issue probably

Steven Deobald 2021-02-11T23:27:04.078800Z

Makes sense. Thanks.

borkdude 2021-02-11T23:27:14.079Z

locally I got:

$ clj-kondo --lint foo.clj
foo.clj:1:32: warning: use alias or :refer [deftest is testing use-fixtures]
foo.clj:2:34: warning: use alias or :refer [join]
linting took 99ms, errors: 0, warnings: 2
while lsp diagnostics gave unresolved symbols

ericdallo 2021-02-11T23:27:39.079200Z

But I can't see why users should disable clojure-lsp linting and use clj-kondo manually (unless you are @borkdudeand always has a clj-kondo snapshot version 😆)

borkdude 2021-02-11T23:27:51.079400Z

ericdallo 2021-02-11T23:28:00.079800Z

@borkdude probably related to the cache that lsp caches on startup?

borkdude 2021-02-11T23:28:22.080Z

I don't know where this cache is

ericdallo 2021-02-11T23:28:33.080200Z

it's from your-project/.clj-kondo/.cache

ericdallo 2021-02-11T23:28:59.080500Z

the behavior in your print happens to me too, but I thought it was expected

borkdude 2021-02-11T23:29:01.080700Z

I don't have a .clj-kondo dir here

borkdude 2021-02-11T23:29:21.080900Z

this file is /tmp/foo.clj

ericdallo 2021-02-11T23:29:24.081100Z

borkdude 2021-02-11T23:29:29.081500Z

and I placed an empty deps.edn there too, just to make sure

borkdude 2021-02-11T23:29:45.081700Z

please remove the quote

borkdude 2021-02-11T23:30:01.081900Z

and make require :require

ericdallo 2021-02-11T23:30:21.082100Z

then it works as expected:

borkdude 2021-02-11T23:31:17.082500Z

but not on my machine.

borkdude 2021-02-11T23:31:35.082900Z

note: there is no .clj-kondo

borkdude 2021-02-11T23:31:49.083100Z

just /tmp/foo.clj and /tmp/deps.edn (empty map)

ericdallo 2021-02-11T23:31:49.083300Z

let me test it on a tmp folder

borkdude 2021-02-11T23:35:23.083500Z

also reproduces for me when I put it in ~/repro/foo.clj

ericdallo 2021-02-11T23:35:41.083700Z

it works:

borkdude 2021-02-11T23:35:46.084100Z

here's my code:

(ns foo (:require [clojure.test :refer :all]
                  [clojure.string :refer :all]))

use-fixtures

(deftest foo (testing (is 1)))

join

ericdallo 2021-02-11T23:36:20.084400Z

/tmp/clojure-sample.clj

borkdude 2021-02-11T23:36:37.084800Z

and you have no /tmp/.clj-kondo?

ericdallo 2021-02-11T23:37:08.085100Z

yep. no /tmp/.clj-kondo or /tmp/.lsp since is not a project

borkdude 2021-02-11T23:37:28.085300Z

this is weird.

ericdallo 2021-02-11T23:37:36.085500Z

😕

borkdude 2021-02-11T23:37:45.085700Z

I can reproduce exactly what Steven has, but only with LSP

Steven Deobald 2021-02-11T23:37:57.085900Z

Hm. Installing clj-kondo (using install-clj-kondo) and running it against my test dir produces the same results.

1😨
Steven Deobald 2021-02-11T23:38:23.086200Z

steven@solasa kosa % clj-kondo --version
clj-kondo v2021.01.20

Steven Deobald 2021-02-11T23:40:14.086400Z

More specifically, it gives me Unresolved symbol: deftest for :refer-all and warning: use alias or :refer [deftest is testing] for :refer :all.

borkdude 2021-02-11T23:40:45.086600Z

@steven427 You should use :refer :all.

borkdude 2021-02-11T23:41:02.086800Z

The linter is called :refer-all

borkdude 2021-02-11T23:41:34.087100Z

You can configure the linter like here: https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md

borkdude 2021-02-11T23:42:02.087600Z

But :refer-all is not valid Clojure syntx

1☝️
Steven Deobald 2021-02-11T23:42:06.087800Z

Oh. :woman-facepalming: Sorry. I was wondering why I didn't recognize it.

borkdude 2021-02-11T23:43:00.088300Z

Nonetheless I get these warnings from LSP :/

borkdude 2021-02-11T23:43:41.088800Z

It's way too later here, I'm off.

ericdallo 2021-02-11T23:45:11.089Z

We can check that tomorrow, thanks @borkdude

Steven Deobald 2021-02-11T23:47:20.089300Z

Okay, that much at least is answered then. If I use --config '{:linters {:refer-all {:exclude [clojure.test]}}}' from the command line, clj-kondo has no complaints.

1
ericdallo 2021-02-11T23:48:10.089600Z

this should work for clojure-lsp too 🙂 You just need to add to your-project/.clj-kondo/config.edn

Steven Deobald 2021-02-11T23:49:41.089800Z

Yeah, I did... surprisingly, it still complains about both :all and the symbols. I'll try bouncing emacs.

ericdallo 2021-02-11T23:54:11.090300Z

sorry outdated one ☝️

Steven Deobald 2021-02-11T23:54:21.090500Z

Cool. It respects the proj/.clj-kondo/config.edn ignore of the :refer-all linter but it unfortunately still says the symbols (`deftest`, etc.) are undefined.

ericdallo 2021-02-11T23:55:23.090900Z

did you import the root of your project the first time started lsp-mode in your project?

Steven Deobald 2021-02-11T23:58:54.091100Z

I'm not sure what that question means

ericdallo 2021-02-11T23:59:16.091300Z

when you open a project with lsp-mode, it asks what is the root of your project

ericdallo 2021-02-11T23:59:18.091500Z

something like that:

ericdallo 2021-02-11T23:59:43.091700Z

Steven Deobald 2021-02-11T23:59:54.092100Z

Oh, I have lsp-mode hooked to clojure-mode