Fork me on GitHub
#lsp
<
2021-04-12
>
alex01:04:56

I've set up a .dir-locals.el for a denylist of files/folders that LSP can ignore. However, LSP still asks if I want to watch ~1500 files (way more than I'm expecting). Does Clojure LSP log which folders/files it thinks it should be watching? I'd love to be able to compare that against my directory structure and see whether I've made an error in my configuration

ericdallo02:04:52

that's a config from lsp-mode , clojure-lsp has no control over that, you should check if your lsp-file-watch-ignored-directories or lsp-file-watch-ignored-files are correct

alex02:04:45

ah gotcha, thanks Eric. yep I'm setting lsp-file-watch-ignored-directories in dir-locals . just wanted to see if there was a way to verify they were being picked up correctly. here's a snippet in case you see anything that stands out

((nil . ((lsp-file-watch-ignored-directories . ("/\\.git$"
                                                "/resources/public/js$"
                                                "/resources/public/img$"
                                                "/resources/public/css$"
                                                "/node_modules$"
                                                "/functions/node_modules$"
                                                "/functions/compiled$"
                                                "/\\.cpcache$"
                                                "/\\.shadow-cljs$")))))
otherwise i'll keep digging. thanks again!

ericdallo02:04:17

Yeah, I think you can suggest it on lsp-mode discord or as a issue, a command that would check what dirs would exclude or something

ericdallo02:04:59

you can add a (message "---> %s" dirs-to-watch) to check

alex03:04:34

woo hoo, that worked well!

alex03:04:52

thanks Eric. also had to go through byte-compiling a file for the first time

alex03:04:04

but learned a few new things about emacs

ericdallo03:04:57

haha nice, I think you should suggest that on https://discord.gg/swuxy5AAgT and try to understand where lsp-log is logging on that line

alex03:04:18

cool, will do! i think i'll post in #troubleshooting

alex03:04:48

haha i've been trying to figure out this lsp files watched issue for a while. turns out clj-kondo has a hidden .cache directory that i didnt know about and that's where most of the watched files were coming from

ericdallo03:04:31

hum.. we should totally add that folder to lsp-mode default ignore dirs...

ericdallo03:04:39

thanks for pointing that

ericdallo03:04:19

it's odd why you needed to add the .clj-kondo/.cache if lsp-mode already ignores the .clj-kondo folder

ericdallo03:04:24

maybe that is not working as expected?

alex03:04:13

hmmm interesting. After adding "/\\.clj-kondo/\\.cache$" to my blocklist, the number of watched files went down from 1500 to 250 I'm using Doom, which is managing my package updates. Looks like my lsp-mode is pretty recent, last commit from 15 days ago Based on this, it does seem like the lsp-mode default ignore dirs is not working but I don't have a great intuition for this stuff 🙂

alex03:04:03

I switched from "/\\.clj-kondo/\\.cache$" to "/\\.clj-kondo$" and still seems to be blocking properly

alex03:04:18

Let me know if you want me to check anything else

ericdallo12:04:31

yes, I confirmed clj-kondo dir is being ignored properly indeed

ericdallo12:04:59

Also, they answered you, the lsp-log logs to a lsp-log buffer, but it just logs the project root dir of the watchers, not the folders itself

practicalli-johnny16:04:42

Is ~/.clojure/.lsp/config.edn a valid location for a clojure-lsp configuration file? That directory also contains an sqlite.db file. I was ~/.lsp/config.edn but that directory has been deleted (I think that was me, but not sure). Should I be using ~/.lsp/config.edn or is ~/.clojure/.lsp/config.edn okay to use (seems a bit tidier, especially as it only has cljfmt configuration in there). If both locations are valid, I assume the ~/.clojure/.lsp/config.edn would take preceedence over the general ~/.lsp/config.edn configuration

ericdallo16:04:45

no, we don't support any ~/.clojure/.lsp ATM moment

ericdallo16:04:17

your config whould be on ~/.lsp/config.edn

ericdallo16:04:08

you probably opened ~/.clojure/deps.edn sometime and plugged lsp there and made ~/.clojure as root what made clojure-lsp create the sqlite file

seancorfield16:04:15

@U05254DQM You get a .lsp folder in any directory that you start an editor that using LSP integration. I keep seeing them popup as new files all over the place because it’s not yet common for new project templates to .gitignore the .lsp/sqlite.db file (and of course no older projects exclude it).

ericdallo16:04:13

exactly, you can have a ~/.gitignore_global , but this is as common as a .clj-kondo/.cache dir

practicalli-johnny16:04:23

Thanks. The strange thing is the configuration in ~/.clojure/.lsp/config.edn seems to work. Either that or lsp stopped annoyingly inserting two line spaces in between comments and keywords at the same I made this change... I'll delete it again and see if I still have that issue. Never a dull moment 🙂

👍 3
practicalli-johnny17:04:19

I think I will set my XDG_CONFIG_HOME to /.config then /.clojure and /.lsp can both be in /.config along with most of the other user level config... and less likely to get deleted by mistake

ericdallo17:04:03

yes, It looks valid

borkdude17:04:34

> exactly, you can have a ~/.gitignore_global , but this is as common as a .clj-kondo/.cache dir Except that clj-kondo won't ever automatically create a .clj-kondo dir anywhere on your system.

👍 3
practicalli-johnny17:04:55

I've had a .gitignore_global ever since I started using Git... its seems many people are missing out...