lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
berkeleytrue 2020-09-29T02:49:55.005800Z

👋 Is there a way to get clojure-lsp to recognize symbols imported using :refer-macros in cljs files? I can work around it by requiring the namespace using :as but I figured I'd ask to see if maybe I'm doing something wrong.

ericdallo 2020-09-29T12:24:06.009Z

Hum, maybe a bug for clojurescript @snoe?

snoe 2020-09-29T19:50:25.010800Z

hrm yeah I dont think i did anything with refer-macros or require-macros it should work exactly like refer. I think all our code just uses refer these days .

berkeleytrue 2020-09-29T20:03:13.011100Z

Should I open an issue?

ericdallo 2020-09-29T03:00:05.005900Z

I think what you are looking for is: https://github.com/snoe/clojure-lsp#macro-defs

berkeleytrue 2020-09-29T03:19:23.006600Z

Yes, I've gotten clojure-lsp to recognize macros, and specifically the macro I'm requiring, but it still won't let me use the specific (:require [some-library :refer-macros [some-macro]) . If I use (:require [some-library :as sl]) (sl/some-macro foo) then it detects the macro correctly with the macro-defs I've added. But I can use it directly as (some-macro foo) with the :refer-macros from clojurescript.

berkeleytrue 2020-09-29T03:21:22.006800Z

example code I'm working on https://github.com/BerkeleyTrue/reframe-todo-cljs/blob/61affdb40c/src/cljs/todo/views.cljs#L7

Ory Band 2020-09-29T10:31:20.007900Z

Hi all. I've been recommended to move the question i asked in #vim to here. I don't want repeat myself, so here's the link to the question. sorry for the confusion: https://clojurians.slack.com/archives/C0DF8R51A/p1601375358005700

berkeleytrue 2020-09-29T15:08:31.009200Z

Hey Ory, I just fixed a similar issue. You can define you macro-defs in the coc-settings.json under initializeOptions, or you can add a .lsp/config.edn in your project root and add the defs there

Ory Band 2020-09-29T16:48:53.009800Z

thanks. i don't want to turn off unresolved symbols completely, just the special ones with ?... for tabular

Ory Band 2020-09-29T16:51:30.010Z

i'm trying this .lsp/config.edn contents and it completely turned of clj-kondo for me

{"clj-kondo" {:linters {:unresolved-symbol {:exclude [(midje.sweet)]}}}

berkeleytrue 2020-09-29T17:17:34.010200Z

oh, the important part is the macro-defs

Ory Band 2020-09-29T18:15:47.010400Z

does it disable unknown symbol errors only for midje? or for everything?

berkeleytrue 2020-09-29T18:21:54.010600Z

the way you have it set up there would exclude all the symbols from midje.swee namespace. I don't think it is supposed to disable the all unresolved symbol linting. I'm not an expert either, so maybe someone else could chime in?