Hey there, any idea how to disable automatically inserting namespaces? (When creating a new file)
I think Cider (or clojure mode?) is already doing that. Now I'm getting 2 when I create a new file
auto-add-ns-to-new-files? false
https://clojure-lsp.github.io/clojure-lsp/settings/
Or disable from clj-refactor:
cljr-add-ns-to-blank-clj-files nil
Thanks, guess I didn't look hard enough π
in case need a example: https://github.com/ericdallo/dotfiles/blob/master/.doom.d/config.el#L97
I think there might be a bug in lsp. When I create the following file: src/clj/gungnir/foobar.clj
I get this:
Oh this might be my project.clj :thinking_face:
hum, probably it's not finding the correct source path
I have both "src" and "src/clj" in my path
Let me try again
oh, probably removing src/clj should fix
but don't know if something will stop working from src/clj
Have to remove src
through π
But that didn't solve it it seems
I think this feature has done more harm than good in my own setup as well. I'll disable it
:source-paths ["src/clj" "src/cljs" "src/cljc"]
@kevin.van.rooijen does just keep src
works and remove the others?
where do I put auto-add-ns-to-new-files?
to globally apply it to all my projects?
I need the others because src
isn't the root of my namespaces
hum, got it
~/.lsp/config.edn?
so if is not root, why clj.gungnir.foobar
is not the correct?
I'm trying to understand the logic here
so we could improve the feature
Because the root starts at src/clj
Any files in the src/clj
directory are top level namespaces
got it, so the feature should check the source paths, probably is not checking correctly
I think so yeah. Seems like "src"
might be hardcoded since it's not in my source path (unless it's added automatically)
it's already checking for source paths, probably some bug
I'll keep debuging
I could create a minimal example if you'd like
yeah, it'd be helpful if you create a issue with a minimal repro π
Will do, currently working so I'll open an issue tonight. Thanks for the help π
np, thanks!
I think I found the bug, it was introduced after kondo migration π I'll create missing tests for it
I now run CIDER and lsp in tandem. Can you also have a REPL using lsp?
@erwinrooijakkers you can just use CIDER and hence nREPL along with lsp. is this not what you're asking?
Yes this is what I am asking
I thought CIDER and nREPL was an alternative
But you can use both
I have heard some people who use spacemacs which makes and alternative solution between the two, which is imo weird. Why would anyone develop software without a REPL.
There is no reason you can't use both at the same time.
Yes thatβs what got me confused in the first place, you can pick the backend
Yep, I try to clarify that here: https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide/
(clojure :variables
clojure-backend 'lsp ;; or 'cider...
just use lsp without this setup. package-install lsp-mode, install the lsp binary on your machine and get going
(if that is possible in spacemacs at all?)
we should fix that on spacemacs if is not clear for users π
Very nice this LSP stuff, reminds me of the extensive IDE functionality of Visual Studio with ReSharper for C#!
Hello! π I haven't used clojure-lsp yet, but reliable rename + find usage + find definition sounds fantastic. I might try to use clojure-lsp in Emacs next time I have a bit of Clojure coding to do. Thanks for your work!
Thank you @teodorlu ! LMK what you think after give a try π
Are these squiggly lines lsp related?
I think so yes, I disabled this
lsp-headerline-breadcrumb-enable nil
I also disabled lenses and lsp-diagnostics-provider
(since I'm running clj-kondo myself)
and also lsp-enable-indentation nil
since I'm using clojure-mode already
ah yes i use aggressive-indent-mode and that needed also to be disabled
My friend (non programmer) is also impressed and gives compliments
ah without the lsp-headerline-breadcrumb-enable
the whole breadcrumbs disappear π I meant the squiggly lines, seems there is some spellchecking going on
@erwinrooijakkers I think it indicates that there are diagnostics in these parts of your app
aaaaah ok
welcome @martinklepsch!
That could be disabled without disable the headerline @erwinrooijakkers
Thanks!
lsp-headerline-breadcrumb-enable-diagnostics
Hey yβall, this clojure-lsp thing is looking pretty sweet :star-struck: Iβm installed coc.nvim for it but Iβm not quite sure how to use it π How would I do some basic stuff like go to definition & search defs more generally?
I control all my dotfiles etc., via ansible and templating, which I deploy across all my computers
every machine of mine (vms, physical) all have the same setup - makes moving from one to the other easy π
Check for lsp-headerline-breadcrumb-diagnostic or something like that
Do I need this file? https://github.com/snoe/dotfiles/blob/master/home/.vim/coc-settings.json
(It looks kind of specific to a developer of the lsp server?)
@rahul080327 probably knows as well as he's using nvim + clojure-lsp as well
Thank you! Hum, I have no experience with coc.vim :/ But @rafaeldelboni or @snoe use it with coc.vim
@martinklepsch https://github.com/lispyclouds/dotfiles/tree/main/nvim
oh, those haven't been updated since 2017, sorry
I havenβt yet gotten to put it yet π
Yes you do need this file to make a custom lsp provider: https://github.com/rafaeldelboni/dotfiles/blob/master/config/nvim/coc-settings.json#L17-L25
Will share it sometime soon
You can access it from anywhere in nvim typing :CocConfig
You don't need the "command" bash
yeah, I wondered about that, it seems superfluous
"languageserver": {
"clojure-lsp": {
"command": "clojure-lsp",
"filetypes": ["clojure"],
"disableDiagnostics": true,
"rootPatterns": ["deps.edn", "project.clj"],
"additionalSchemes": ["jar", "zipfile"],
"trace.server": "verbose",
"initializationOptions": {
"project-specs": [{
"project-path": "deps.edn",
"classpath-cmd": ["clj", "-Spath"]
}],
"use-metadata-for-privacy?": true,
"ignore-classpath-directories": true
}
}
}
thanks gonna update mine
This is mine: https://gist.github.com/dharrigan/6b55013de0d4d8b8447b5cff2f36e030
We could do a coc-clojure-lsp, like https://github.com/fannheyward/coc-rust-analyzer or https://github.com/clangd/coc-clangd, the interesting part is the auto download and build of the dependencies, but I never did this before.
Looks good βοΈ
thanks @dharrigan I updated my ~/.config/nvim/coc-settings.json
to match yours. If youβre feeling generous, would you mind sharing a bit on how you use all this?
I do use neovim, conjure, coc and clojure-lsp (and a few other sprinklings of plugins)
Do you use neovim?
My setup is pretty similar actually (nvim, conjure, coc, clojure-lsp)
I have been thinking for a while to put my settings up somewhere, but laziness has got the better of me.
I should do it
I think it would invaluable to learn from each other, perhaps there's a setting that I've overlooked, that someone uses and makes their experience stellar.
Totally, Iβll virtually treat you to a beer if that provides any motivation π
π I don't drink
You can virtually buy me some fancy chocolate.
haha, for a moment I was considering that beer may not be your choice but then I went with it anyways β chocolate it is π
when you publish something somewhere, send me your address π
Tada! https://wepl.blog/
Really cool @dharrigan!
What do you think about the @rafaeldelboni idea about a common repo for those settings + auto download ?
Sounds good, or maybe a repo with links to various other people's settings? I'm easy!
I like the way coc-rust-analyzer centralize all settings and allow add more features https://github.com/fannheyward/coc-rust-analyzer
brb
din dins
Fixed on master @kevin.van.rooijen!
Awesome I'll try it out π
still need to release π probably I will do tonight after other fixes
Built it locally. Now only 1 namespace gets added (and it's correct)
Althoough I'd think 2 would get added since I didn't disable clj-refactor :thinking_face: Oh well it works, thanks!
hahaha nice!