Fork me on GitHub
#lsp
<
2021-07-19
>
bartuka03:07:15

hey @ericdallo how are you? I have a lein project where :source-paths is handled by dynamic evaluation and seems like clojure-lsp is not handling this correctly at initialization phase. I made a reproducible repo for this error, https://github.com/wandersoncferreira/source-path-repro is this a known issue?

all-clear 4
bartuka03:07:10

as a workaround I am defining :source-paths in .lsp/config.edn file.

ericdallo12:07:10

Could you share your project.clj?

ericdallo12:07:00

Clojure-lsp reads the project.clj :source-paths from root level and some default aliases and fallback to a default if not found

ericdallo12:07:50

Oh I didn't notice your repro link, let me check

ericdallo12:07:10

This is related with dyncamic source-paths indeed, clojure-lsp can't resolve them as it uses static analysis so I'll fix it to use fallback to the default source-paths or use the provided from user

ericdallo13:07:21

@UBSREKQ5Q I made a https://github.com/clojure-lsp/clojure-lsp/commit/b3eeed1043b620833b2709f3742efd8bec9b6ef2, could you validate if that avoid at least the wrong source-paths for your project?

ericdallo13:07:11

Thank you for the report though!

bartuka13:07:18

I will check now, thanks

bartuka13:07:45

works! 🙂 however, I think would be nice to emit a warning into clojure-lsp::std-error buffer informing that config was invalid and clojure-lsp fallback to defaults

ericdallo13:07:19

yeah, that could be done as a improvement indeed

👍 4
ericdallo15:07:22

clojure-lsp Released https://github.com/clojure-lsp/clojure-lsp/releases/tag/2021.07.19-14.46.52 🚀 • General ◦ clean-ns now sorts ns children forms according to the https://github.com/bbatsov/clojure-style-guide#comprehensive-ns-declaration, at the moment moving require form before import form, enabled by default under flag `:clean :sort :ns` setting. ◦ Improve startup error handler and logging during project analysis. Related to https://github.com/clojure-lsp/clojure-lsp/issues/484Performance improvements using transducers on analysis queries. ◦ Fixed auto-resolve source-paths for lein projects that get source-paths dynamically, clojure-lsp will use the default source-paths for these cases • Editor ◦ Improve hover output, both markdown and plain text forms. (kudos @nbtheduke) ◦ Allow calling thread-first/last and thread-first-all/last-all from within the list. (kudos @nbtheduke) ◦ Improve `resolve-macro-as` messages and default excluded symbols. c/c @brandon.ringe • API/CLI ◦ Fix empty `XDG_CONFIG_HOME` not defaulting to `$HOME/.config` https://github.com/clojure-lsp/clojure-lsp/issues/474 (kudos @andreyorst) ◦ Improve verbose logging setting to now show logs along with `Analysis project` message. Probably the most important improvement is the performance one, using transducers and improving the analysis comparassion using `identical?` for keywords and `.equals` with type hint for symbols and strings reduced some analysis time by half using https://github.com/hugoduncan/criterium as the benchmark tool, this should affect most features that use clj-kondo analysis under the hood.

🎉 8
catjam 2
🚀 2
bringe16:07:39

Thanks for the resolve-macro-as improvements. It's great to hear performance improvements have been made!

😄 2
anonimitoraf19:07:22

Thanks for the updates! I notice occasional freezes when saving a file. I'll see if I can repro later

ericdallo19:07:12

thanks! I'd guess is a issue with lsp client, LMK when have the repro

👍 2
dpsutton16:07:39

i just updated lsp-mode for emacs. I'm hitting C-M-x which C-h c verifies is bound to inf-clojure-eval-defun and i'm instead getting an error Symbol's value as variable is void: lsp-actionscript. Does this ring a bell for anyone?

ericdallo16:07:18

I think I saw this issue somewhere on lsp-mode

ericdallo16:07:36

I'd suggest asking on lsp-mode discord channel

👍 2
pez16:07:22

clojure-lsp is one of the most impressive projects out there! Improving at an almost incredible pace. Stellar support on top of that.

❤️ 10
16
Oliver George23:07:27

Quick observation from a first timer. From the release notes I was curious to try clean-ns! from a deps.edn alias. It's not a use case covered neatly in documentation (or I couldn't find it). Not sure it's a primary use case so that might be fine. Anyway, here's how I did it...

{:deps  {...}
 :paths ["src"]
 :aliases
  {:lint-ns {:extra-deps {com.github.clojure-lsp/clojure-lsp {:mvn/version "2021.07.19-14.46.52"}}
             :exec-fn clojure-lsp.api/clean-ns!
             :exec-args {:dry? true}}}}
then invoked by
clojure -X:lint-ns

all-clear 4
Oliver George23:07:59

As an aside, it failed with a timbre related error. Syntax error compiling at (taoensso/timbre/appenders/core.cljc:30:4). No such var: enc/system-newline Full report at: /var/folders/p1/mtpt77lx3gv5q88s9_l0b2w00000gp/T/clojure-4034124860266134319.edn

ericdallo23:07:33

Hey @U055DUUFS there is an example here of using it as a lib on a deps.edn: https://clojure-lsp.github.io/clojure-lsp/api/#library

ericdallo23:07:51

But your code looks good

ericdallo23:07:14

Could you try adding the :verbose true flag?

ericdallo23:07:03

Not sure this could help, but can you try use replace-deps instead of extra-deps

Oliver George23:07:31

Ah, good stuff. Showing the cli command might help those unfamiliar with :exec-fn

Oliver George23:07:11

s/ns-inner-blocks-indenation/ns-inner-blocks-indentation/

Oliver George23:07:04

Same error with verbose flag. I'm trying out the brew installed binary now... exciting stuff.

ericdallo23:07:17

Thanks, I'll update the typo

ericdallo23:07:40

Could you paste the stacktrace with the verbose flag?

Oliver George23:07:23

That includes the full deps.edn, shell session and log file generated.

ericdallo23:07:06

humm, I think the issue is a conflict with your lib: com.taoensso/encore {:mvn/version "2.75.0"}

ericdallo23:07:27

because clojure-lsp logging lib, timbre , uses encore under the hood

ericdallo23:07:55

and the version you use probably is different from the version clojure-lsp timbre uses

ericdallo23:07:58

you actually have an outdated encore lib. timbre is using a more updated https://github.com/ptaoussanis/timbre/blob/master/project.clj#L14

ericdallo23:07:30

that's why I suspect replacing :extra-deps with :replace-deps could work for you

Oliver George23:07:14

Thanks, I'll give that a try. (it's a super old project)

Oliver George23:07:03

Much happier now (still running)

ericdallo23:07:31

I confirmed bumping com.taoensso/encore to latest fix the issue

Oliver George00:07:01

Thanks for your time.

👍 4
Oliver George00:07:11

(finished successfully here too)

🚀 4
Oliver George23:07:04

Can't tell you how nice it is to have clean-ns in my life. Thank you.

❤️ 6
🚀 4