Fork me on GitHub
#lsp
<
2022-09-08
>
sheluchin12:09:39

I'm not sure if this is an LSP problem or a vim configuration issue, but I notice that if I have a clj-kondo :lint-as config such as:

com.wsscode.pathom3.connect.operation/defresolver clojure.core/defn
When I and define a resolver with defresolver, my editor subsequently does not show me the docstring or arglists for it as it does with a defn. Is this expected behaviour?

ericdallo12:09:49

it could be a bug on clj-kondo, do you have a sample project where I can give it a try? also, I can see how this config could go on pathom3 project itself to work out of the box for all users of the lib c/c @U066U8JQJ :) (https://github.com/nubank/state-flow/blob/master/resources/clj-kondo.exports/nubank/state-flow/config.edn)

sheluchin12:09:30

It is in Pathom3's shared clj-kondo config: https://github.com/wilkerlucio/pathom3/blob/main/.clj-kondo/com.wsscode/pathom3/config.edn#L2 As for clj-kondo, it does actually include the information in the analysis data:

#?(:clj
   (pco/defresolver fooburr
     [{:keys [x]}]
     {:foo :bar}))
{:fixed-arities #{1},
 :end-row 396,
 :name-end-col 28,
 :name-end-row 394,
 :name-row 394,
 :ns foo,
 :name fooburr,
 :defined-by clojure.core/defn,
 :lang :clj,
 :filename "./src/foo.cljc",
 :col 4,
 :name-col 21,
 :end-col 18,
 :arglist-strs ["[{:keys [x]}]"],
 :row 394}
Would you still like a repro repo?

ericdallo12:09:46

that folder is for pathom3 project only, when you are coding on that project, to export that config it need to be inside the classpath, usually in the resources folder

sheluchin12:09:10

I see. I'll read this part of the docs to remind me how it should work. Maybe I have something misconfigured elsewhere. But it doesn't change the observation since I have it in my project .clj-kondo/config.edn anyhow, right?

wilkerlucio13:09:28

@UPWHQK562 also check if might be a bug in the LSP implementation for vim, I use that config to lint projects with Pathom, but since I use IntelliJ as the editor I'm not going though LSP for editor hints

sheluchin13:09:33

How can I verify that clojure-lsp itself has the data to check whether it's a vim (coc.nvim) issue?

ericdallo13:09:07

@UPWHQK562 maybe with a sample project I can try at my side and remove any possibility to be a bug on server side

sheluchin13:09:13

Sounds good, I'll make a repo and will ping you here sometime later. Thanks!

sheluchin17:09:57

Ah, figured it out. It was an issue with my vim configuration and not with LSP. Sorry to bother and thanks for the help!

🙌 2
djm12:09:31

Related: if I have a macro in :lint-as, the unresolved symbol errors go away, but should I expect it to work with lsp-find-definition, etc?

djm17:09:10

Anyone? It doesn't currently work for me. Should it?

ericdallo17:09:46

sorry, missed this thread do you have a code example?

djm17:09:21

I.e. if I have (deffoo foo ...), and call foo, lint-as makes the linter errors go away, but I still can't get to the deffoo line with lsp-find-references etc

ericdallo18:09:15

it does work for me :thinking_face:

ericdallo18:09:35

.clj-kondo/config.edn

{:linters {clj-kondo.core/deffoo clojure.core/def}}

djm07:09:45

Changing clj-kondo.lint-as/def-catch-all to clojure.core/def fixed it, thank you.

djm07:09:08

By the way, I have :list-as, not :linters. Does that make any difference?

ericdallo12:09:15

oh yeah, my mistake, the correct should be :lint-as indeed

👍 1