Fork me on GitHub
#lsp
<
2021-09-02
>
borkdude11:09:21

I'm excited to see that #lsp is being funded by CT in Q3. Congrats @ericdallo!

🎉 10
ericdallo12:09:58

Thank you @borkdude and everyone that helped! This will be a huge help for the project and I'm really happy and excited to see the results of that funding! clojure-lsp gratitude clojurists-together

djm13:09:16

I’m getting “Lisp nesting exceeds ‘max-lisp-eval-depth’” errors after lsp starts (sometimes emacs also freezes for a while first). The backtrace seems to suggest that it’s something to do with lsp-all-watchable-directories (I think). Is there anything I can do to figure out why?

ericdallo13:09:49

everything ok in lsp-diagnose ?

ericdallo13:09:23

otherwise, probably a bug or something that may be tweaked on lsp-mode

ericdallo13:09:02

also check your max-lisp-eval-depth variable , for me, doom-emacs sets that to 1600

djm13:09:48

Checking for Native JSON support: OK
Check emacs supports `read-process-output-max': OK
Check `read-process-output-max' default has been changed from 4k: OK
Byte compiled against Native JSON (recompile lsp-mode if failing when Native JSON available): OK
`gc-cons-threshold' increased?: OK
Using gccemacs with emacs lisp native compilation (): NOT AVAILABLE (OPTIONAL)

djm13:09:22

max-lisp-eval-depth is 800

ericdallo13:09:05

try to set that to 1600 and check if it works for you

ericdallo13:09:25

Even so, maybe it's a good idea ask on https://discord.gg/swuxy5AAgT

djm13:09:37

It still freezes for a while, and then Error processing message (error "Variable binding depth exceeds max-specpdl-size").

ericdallo13:09:43

yeah, so, what I think it's happening is that lsp is scanning a lot of folders and probably a lot of them are not required to be analyzed, check your *lsp-log* when server starts, it should print the folders/files being analyzed

ericdallo13:09:47

probably (setq lsp-enable-file-watchers nil) should fix, but not sure the file watchers feature is good for you

djm13:09:31

In lsp-log, I just have

Found the following clients for /path/file.clj: (server-id clojure-lsp, priority 0)
The following clients were selected based on priority: (server-id clojure-lsp, priority 0)
(`/path/file/clj` changed as it’s work stuff)

djm13:09:47

(setq lsp-enable-file-watchers nil) fixes it, thank you

djm13:09:04

It only started happening quite recently - did anything about it change?

ericdallo13:09:19

I don't think so, there are better ways to solve that probably, like configuring lsp-mode to exclude specific folders from your project

ericdallo13:09:40

using lsp-file-watch-ignored-directories or lsp-file-watch-ignored-files

djm13:09:36

Thank you. What kind of directories should I be ignoring? Non-clojure ones?

djm13:09:11

:thumbsup:

ericdallo13:09:16

mostly huge folders

ericdallo13:09:35

like node_modules and etc (lsp-mode already exclude node_modules)

djm13:09:02

There’s a couple of node_modules directories in here. Only one other large directory, I think

ericdallo14:09:00

lsp-mode should log on *lsp-log* the folders being analyzed, not sure why it's not logging :thinking_face:

djm14:09:10

Which way up are emacs backtraces? It starts like this: ` entered--Lisp error: (error “Lisp nesting exceeds ‘max-lisp-eval-depth’“) file-truename(“/Users” (90) (nil)) file-truename(“/Users/djm” (90) (nil)) file-truename(“/Users/djm/Library” (90) (nil)) file-truename(“/Users/djm/Library/Containers” (90) (nil)) file-truename(“/Users/djm/Library/Containers/com.apple.Safari.CacheDeleteExtension” (90) (nil)) file-truename(“/Users/djm/Library/Containers/com.apple.Safari.CacheDeleteExtension/Data” (90) (nil)) file-truename(“/Users/djm/Library/Containers/com.apple.Safari.CacheDeleteExtension/Data/Library” (90) (nil)) file-truename(“/Users/djm/Library/Containers/com.apple.Safari.CacheDeleteExtension/Data/Library/WebKit” (90) (nil)) file-truename(“/Users/djm/Library/Containers/com.apple.Safari.CacheDeleteExtension/Data/Library/WebKit/WebsiteData” (90) (nil)) file-truename(“/Users/djm/Library/Containers/com.apple.Safari.CacheDeleteExtension/Data/Library/WebKit/WebsiteData/IndexedDB” (90) (nil)) file-truename(“/Users/djm/Library/Containers/com.apple.Safari.CacheDeleteExtension/Data/Library/WebKit/WebsiteData/IndexedDB/v0”) lsp--all-watchable-directories(“/Users/djm/Library/Containers/com.apple.Safari.CacheDeleteExtension/Data/Library/WebKit/WebsiteData/IndexedDB/v0" (“[/\\\\]\\.git\\‘” “[/\\\\]\\.github\\‘” “[/\\\\]\\.circleci\\‘” “[/\\\\]\\.hg\\‘” “[/\\\\]\\.bzr\\’” “...``

djm14:09:55

Why would it be looking at /Users/djm/Library/Containers/com.apple.Safari.CacheDeleteExtension/Data/Library/WebKit/WebsiteData/IndexedDB/v0 😕

ericdallo14:09:10

that's seems to be the issue 😅

ericdallo14:09:16

are your project root correct?

ericdallo14:09:17

my guess is that you have your home imported as a project root

ericdallo14:09:30

you can confirm/remove it with lsp-workspace-folders-remove

djm14:09:10

Everything listed there is either ~/src/foo or $M2_REPO/foo

ericdallo14:09:07

hum, really weird lsp-mode looking on that folder, I really suggest opening an issue on lsp-mode showing that

ericdallo14:09:25

you can also debug lsp-mode code if you want starting from the lsp--all-watchable-directories function

djm14:09:24

Okay, I’ll open an issue later. Thanks for your help.

👍 2
djm15:09:52

There was a directory in the project called ~ rage4 😂

djm15:09:59

(and that was causing it to try to watch my home directory)

ericdallo15:09:54

That makes sense now :)

Noah Bogart19:09:52

@ericdallo sorry about the :source-paths bug, that one is my fault, lol. i’ve opened a pr that should fix it https://github.com/clojure-lsp/clojure-lsp/pull/540

ericdallo19:09:10

No problem! Thanks for taking a look

Noah Bogart19:09:19

i misread the settings page and thought both :source-paths and :source-aliases returns keywords

👍 2
Noah Bogart19:09:55

do you want the default to be nil or #{}?

ericdallo19:09:17

#{} seems better

👍 2
dpsutton19:09:14

I've asked this in the past and was told it was a project config error but i haven't solved it and have just been putting it off. I am using [clojure.test :refer :all] in our test namespaces. lsp-ui is offering a warning "use alias or :refer [refer-all]" which doesn't make a lot of sense to me. And each usage of deftest and is is highlighted as an unknown symbol. How can i diagnose this?

ericdallo19:09:11

me and @borkdude had this issue last week with an user, it was related with outdated clj-kondo analysis + outdated sqlite.db

ericdallo19:09:58

can you please: • confirm there is a .clj-kondo dir on your project root • if so rm .clj-kondo/.cache and rm .lsp/sqlite.db • restart the server

dpsutton19:09:07

there is no .clj-kondo dir in my project root.

dpsutton19:09:16

should i nuke the cache and db and restart still?

dpsutton19:09:57

clojure-lsp --version
clojure-lsp 2021.08.24-14.41.56
clj-kondo 2021.08.07-SNAPSHOT

ericdallo19:09:51

it's a must have a .clj-kondo dir (future releases of clojure-lsp it should create automatically)

borkdude19:09:01

you could make a .clj-kondo first, else :refer :all won't work at all

borkdude19:09:12

oh no wait, clojure.test is built-in

ericdallo19:09:14

this is necessary for clj-kondo fill the .cache

borkdude19:09:14

there we go again

😂 2
borkdude19:09:35

since he has no cache, how can this not work

ericdallo19:09:55

even being built-in, other thing should not working properly without the .clj-kondo dir, I suggest you creating it

ericdallo19:09:58

good question

dpsutton19:09:55

i need to create the .clj-kondo dir?

ericdallo19:09:20

@U11BV7MTK could you confirm the issue is fixed if you create a .clj-kondo/config.edn with {} ? then we can understand later why clj-kondo is not recognizing clojure.test built-in

dpsutton19:09:45

yes. in the meantime i wiped the sqlite db and restarted but it has not been fixed

ericdallo19:09:57

after creating it, you still need to rm .lsp/sqlite.db and restart server

dpsutton19:09:38

excellent. that fixed it. i didn't realize i had to manually create a clj-kondo folder

ericdallo19:09:00

just to explain how it works: • clojure-lsp checks if there a .lsp/sqlite.db if so it doesn't call clj-kondo to analyze the whole classpath which takes a while • when clj-kondo is analyzing the whole classpath, it persists in .clj-kondo/.cache the transits from each namespace analyzed, but only if a .clj-kondo folder exists • when linting, it uses the cache so it knows external namespaces from classpath That works for external libs, but clojure.test should be built-in on clj-kondo not depend on that kind of cache

dpsutton19:09:09

thanks. just a data point: i'm ok with manually creating it. helps me add it to gitignore as well. Just didn't know i needed to

dpsutton19:09:12

thank you both

ericdallo19:09:40

no problem is just that most users don't know (and they don't need to know) about how that works

ericdallo19:09:48

as an IDE that should work OOTB

borkdude20:09:23

Still I don't know why this would go wrong without a .clj-kondo dir. Perhaps a concurrency bug with --parallel or so (should not be related to the presence of a .clj-kondo dir).

2
borkdude20:09:54

But glad it works.