This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-15
Channels
- # announcements (10)
- # asami (5)
- # babashka (49)
- # babashka-sci-dev (8)
- # beginners (25)
- # calva (98)
- # cider (2)
- # clj-kondo (22)
- # clojure (32)
- # clojure-dev (12)
- # clojure-europe (32)
- # clojure-nl (3)
- # clojure-spec (3)
- # clojure-uk (10)
- # clojurescript (12)
- # community-development (1)
- # conjure (71)
- # cursive (7)
- # datalog (6)
- # events (2)
- # figwheel-main (2)
- # fulcro (4)
- # jobs (2)
- # kaocha (3)
- # lsp (43)
- # membrane (12)
- # missionary (9)
- # off-topic (61)
- # pathom (7)
- # polylith (2)
- # reagent (38)
- # remote-jobs (4)
- # shadow-cljs (17)
- # specter (1)
- # tools-deps (38)
- # vim (51)
- # web-security (5)
Hi, I've been trying out vim-iced with Vim. When I type 'K' while on a function name from clojure.core
the docstring pops up (or ':IcedDocumentPopupOpen`). But when I do the same thing to one of my function names--even in the same file as its definition--I get the error "Not found." (By contrast, with fireplace, 'K' works for either case.) So there is something that I have not told vim-iced to do in order to find definitions. I haven't yet found anything about this in the online doc webpage or the vim help doc. Any suggestion? This is what I have in my vimrc:
call plug#begin('~/.vim/plugged')
Plug 'ctrlpvim/ctrlp.vim'
Plug 'guns/vim-sexp', {'for': 'clojure'}
Plug 'liquidz/vim-iced', {'for': 'clojure'}
call plug#end()
let g:iced_enable_default_key_mappings = v:true
OK, everything works if I start and connect to the repl using :IcedJackIn
. It's only when I run 'iced repl' from an actual terminal prompt, and then connect to it using :IcedConnect
that my docstrings are not found. Ah, and this seems to be because :IcedJackIn
runs 'iced repl --instant', which also makes definitions work if I run it from the command line. So: problem solved, I think. But I don't understand what '--instant' is doing, since the docs seem to say that it runs 'clj' without any config files, but it's clearly running 'lein repl' with project.clj.
Having some odd errors when I'm using go to definition with CoC, not sure when they started happening unfortunately.
I have an empty coc-settings.json, I use the coc-clojure
plugin for CoC.
When I run coc-definition
nothing happens in the editor, but I see the request coming into the lsp..
I run a standard leinigen project.
Anyone have some ideas on how to debug this?
In you coc-settings.json, set clojure output to verbose (I’m forgetting the specific flag), then open :CocCommand and run the showOutput command, and then watch the new window when you run “go to definition”. Maybe that can point in the right direction
Do you have clojure-lsp installed? Coc-clojure doesn’t install it for you
Yeah I have it installed and it is launched when I open a clojure file in my project, I can tail it's log and so forth. I'll try your suggestion when I get to my workstation!
Please let me know if it's from coc-clojure, I don’t want to hurt anyone's workflow
It's a weird one. I'm able to goto definition (to a function in a jar) repeatingly, but on another function (in same jar) I can open it once, but that's it. After that, goto definition returns empty string
it would be great to verify if it's just me, or happens to other using neovim + coc-clojure + clojure-lsp 🙂 I have a small repo on github to try out.
Okay, issue solved. By using the dependency scheme of zip (and with a forthcoming little change to coc-clojure, to support zipfile), all is once again well with the world.
Hmm - how should a decent coc-settings.json look when I run coc-clojure
?
Everything works well when I remove coc clojure and use a manual config like this:
{
"coc.preferences.useQuickfixForLocations": true,
"suggest.snippetIndicator": "🍦",
"languageserver": {
"clojure-lsp": {
"command": "clojure-lsp",
"filetypes": ["clojure"],
"rootPatterns": ["project.clj", "deps.edn"],
"additionalSchemes": ["jar", "zipfile"],
"trace.server": "verbose",
"initializationOptions": {
"log-path": "/tmp/lsp.out",
"ignore-classpath-directories": true
}
}
}
}
Hmmm interesting. That seems pretty close to how coc-clojure does everything
What differences are you seeing?
@U6T7M9DBR I have my coc-settings
here:
Heyo!
The main difference is that go to definition works with the minimal "manual" configuration but not with coc-clojure and an empty coc -settings
🙂
David I had your coc-settings
when the issue first started (you're a godsend!).
I can add all your settings to the above semi minimal config, and it works real good.
I feel a bit behind on the work that pays the bills atm, but I'd be happy to mess around with coc-clojure
locally when I have the time.
There's been quite a lot of breakage the last few months with neovim, conjure and so on. Maybe CoC has had some of that as well.
Have you looked at any of the logs provided by either lsp or coc-nvim?
Yeah they "looked good" naively but I haven't been systematical enough to get a repro going. I'll do that next but might be a while
I think if I follow your suggestions from before I'll be able to get a good repro going, you should ignore this until then 🙂
@U6T7M9DBR my vimconfig repo has been updated, maybe you might find some juicy stuff there!
The old #_
trips me up too many times, especially when I use it along with regular comments. Is there some way to set highlighting to make it obvious that an expression is commented out with the comment macro?
we could do that on LSP side which would be cool for every editors, but is not trivial I think
Tree-sitter highlighting does that, as configured in https://github.com/rafaeldelboni/nvim-fennel-lsp-conjure-as-clojure-ide
My understanding is that treesitter somewhat conflicts with clojure-lsp. Is that right?
Between semantic tokens, LSP, coc.nvim (with its own plugins), and treesitter, I find it all a little bit confusing as to what is doing what 🤕 But alas:
I fully agree with that sentiment. A bunch of partially overlapping tools like that is hard to follow, as wonderful as all of them might be individually.
Yes, on emacs side there is only the major mode built-in on emacs and LSP semantic tokens, vim seems to have treesitter as additional, adding one more element to confuse indeed
Yes, all great tools. Just a little hard to understand. As an example. neovim doesn't currently have support for semantic tokens, but it's https://github.com/neovim/neovim/pull/15723 it will be part of the release next month. Yet... I have semantic tokens enabled in my coc.nvim, and if I disable it, things look different :man-shrugging:
Reminds me of that old joke.. > My belt holds my pants up, but the belt loops hold my belt up. I don't really know what's happening down there. Who is the real hero? Mitch Hedberg
Re semantic tokens: looks like that PR is adding support for nvim's lsp client, which coc.nvim already has.
@UJY23QLS1 Thanks for the clarification. The way coc.nvim does so much and even more with its plugins and extensions adds to my confusion on these matters. I should really just set aside some time to go through its docs and some tutorials instead of just pluggin' and playin' with it like I have been.
I kinda got forced to look at the configs in detail, because I switched to rafael's config "cold turkey", and basically had to relearn how to Clojure in vim. At least Conjure was a pleasant constant between it and my old setup. 🙂
Indeed 😄 if any of this stuff was totally broken, there would be a real incentive to go through it. As it is, it mostly works and just has some annoying bits here and there, so the motivation to spend a bunch of time figuring it out is pretty low... But one day!
I'm in the process of recruiting (or trying) someone into the Clojure world, and while I happily use vim-iced, I'm going to start them off with Rafael's Conjure package... So I guess I'll see if it's worth switching from iced, because I otherwise quite like it.
just wanted to add that lsp and tree sitter are both core features in nvim - they don't conflict at all. Although, when semantic tokens land we will have 3 choices for how to highlight code (vim syntax, tree sitter, lsp semantic tokens) so it's still confusing...