Fork me on GitHub
#clj-kondo
<
2020-01-28
>
Nico Hartto12:01:28

Hello @borkdude, thank your for the great tool first and foremost :) I'm trying to get LSP server working with clj-kondo-lsp-server-2020.01.13-standalone.jar and IntelliJ IDEA 2019.3.1 + LSP Support 1.6.0 (+ Cursive) as per https://github.com/borkdude/clj-kondo/blob/master/doc/editor-integration.md#lsp-server-1. For reason or another, when trying to set {:lint-as {nedap.speced.def/defn clojure.core/defn}} in .clj-kondo/config.edn to resolve speced defn as defn it does not seem to work. Simple things like linting (inc "a") work as expected. Is there something I'm missing in the configuration/misconfiguration or is there a way to debug this in someway?

borkdude12:01:06

> thank your for the great tool thanks! > it does not seem to work can you try to reproduce this using a command line invocation, as that excludes issues with other tooling can you also give a bit more information than "it does not work"? :)

Nico Hartto13:01:57

Here's how it shows up on idea when I have LSP running. Normal defn just shows the "typo" green, but for speced/defn I'm getting red underlining which does not happen without clj-kondo. When LSP server raw command is removed, both show without red underlining. Not working might be overstatement, but it's visually less appealing this way.

borkdude13:01:22

Can you reproduce this using a command line invocation?

borkdude13:01:08

e.g.:

$ clj-kondo --lint - --config '{:lint-as {nedap.speced.def/defn clojure.core/defn}}' <<< "(ns foo (:require [nedap.speced.def :as speced])) (speced/defn destructuring-example [{:keys [^string? a] :as ^::thing all}])"
<stdin>:1:104: warning: unused binding a
<stdin>:1:120: warning: unused binding all

4
borkdude13:01:18

That seems to work perfectly.

borkdude13:01:04

Maybe you do not have the alias speced since that's also underlined in your screenshot

Nico Hartto13:01:19

It's just for the "typo warning", but I will try with the cli option to see what's-what

thumbnail13:01:21

This is my lint-as option map btw:

:lint-as '{nedap.speced.def/def-with-doc clojure.core/defonce
              nedap.speced.def/defn         clojure.core/defn
              nedap.speced.def/defprotocol  clojure.core/defprotocol
              nedap.speced.def/doc          clojure.repl/doc
              nedap.speced.def/fn           clojure.core/fn
              nedap.speced.def/let          clojure.core/let
              nedap.speced.def/letfn        clojure.core/letfn}

👍 4
borkdude14:01:38

@UHJH8MG6S and I assume that works for you?

thumbnail14:01:14

@borkdude it does, but i run the formatter using the clj-kondo.core/run! api, no LSP setup here.

borkdude15:01:29

Maybe the editor is not picking up your config because of the current working directory your in @USR9PTXHB

Nico Hartto10:01:45

Works now, it must be that my IDEA setup was different for this project. It works on a different project as expected. Thank you all for the input & help 🙂

borkdude15:01:25

The next clj-kondo will have a new (optional) linter that checks if namespaces are sorted. Thanks @helios

parrot 48