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
yes, I confirmed clj-kondo dir is being ignored properly indeed
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
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
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!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
@rahx1t it seems lsp-mode already logs it somewhere https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-mode.el#L1732
you can add a (message "---> %s" dirs-to-watch)
to check
woo hoo, that worked well!
thanks Eric. also had to go through byte-compiling a file for the first time
but learned a few new things about emacs
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
cool, will do! i think i'll post in #troubleshooting
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
hum.. we should totally add that folder to lsp-mode default ignore dirs...
thanks for pointing that
oh, it seems lsp-mode already ignores that folder: https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-mode.el#L336
it's odd why you needed to add the .clj-kondo/.cache
if lsp-mode already ignores the .clj-kondo
folder
maybe that is not working as expected?
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 🙂
I switched from "/\\.clj-kondo/\\.cache$"
to "/\\.clj-kondo$"
and still seems to be blocking properly
Let me know if you want me to check anything else
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
no, we don't support any ~/.clojure/.lsp
ATM moment
your config whould be on ~/.lsp/config.edn
you probably opened ~/.clojure/deps.edn
sometime and plugged lsp there and made ~/.clojure
as root what made clojure-lsp create the sqlite file
@jr0cket 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).
exactly, you can have a ~/.gitignore_global
, but this is as common as a .clj-kondo/.cache
dir
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 🙂
this is how we resolve config: https://github.com/clojure-lsp/clojure-lsp/blob/master/src/clojure_lsp/config.clj#L64-L90
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
yes, It looks valid
> 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.
I've had a .gitignore_global ever since I started using Git... its seems many people are missing out...