Fork me on GitHub
#vim
<
2022-03-15
>
mars0i02:03:37

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:

mars0i02:03:41

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

mars0i04:03:47

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.

emilaasa08:03:41

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?

Noah Bogart12:03:20

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

Noah Bogart12:03:31

Do you have clojure-lsp installed? Coc-clojure doesn’t install it for you

emilaasa12:03:28

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!

dharrigan16:03:37

I have some problem with goto defintion atm

dharrigan16:03:40

which I'm trying to debug

dharrigan16:03:50

if you want to team up, happy to help

dharrigan16:03:57

so we may both resolve our issues 🙂

Noah Bogart16:03:27

Please let me know if it's from coc-clojure, I don’t want to hurt anyone's workflow

dharrigan17:03:17

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

dharrigan17:03:40

(on that function. The first function works repeatingly)

dharrigan17:03:47

I'm deep in clojure-lsp land atm

dharrigan17:03:31

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.

dharrigan08:03:47

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.

emilaasa13:03:16

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
      }
    }
  }
}

Noah Bogart14:03:20

Hmmm interesting. That seems pretty close to how coc-clojure does everything

Noah Bogart14:03:28

What differences are you seeing?

dharrigan14:03:19

@U6T7M9DBR I have my coc-settings here:

dharrigan14:03:28

maybe that might help?

emilaasa13:03:02

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.

emilaasa13:03:31

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.

emilaasa13:03:20

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.

Noah Bogart13:03:30

Have you looked at any of the logs provided by either lsp or coc-nvim?

emilaasa13:03:05

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

emilaasa13:03:01

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 🙂

👍 1
dharrigan09:03:58

@U6T7M9DBR my vimconfig repo has been updated, maybe you might find some juicy stuff there!

emilaasa14:03:49

I'll check it out!

sheluchin20:03:42

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?

ericdallo21:03:43

emacs does exactly that, and it really helps indeed:

💯 1
ericdallo21:03:11

we could do that on LSP side which would be cool for every editors, but is not trivial I think

sheluchin21:03:01

My understanding is that treesitter somewhat conflicts with clojure-lsp. Is that right?

walterl21:03:19

Haven't had any issues thus far 🙂

sheluchin21:03:07

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:

sheluchin21:03:12

Thanks for the tip on that one.

walterl21:03:16

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.

1
ericdallo21:03:37

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

sheluchin21:03:49

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:

sheluchin21:03:24

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

😆 1
walterl22:03:37

Re semantic tokens: looks like that PR is adding support for nvim's lsp client, which coc.nvim already has.

sheluchin23:03:00

@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.

💯 1
walterl23:03:55

Yeah, but "ain't nobody got time for that!" 😛

walterl23:03:42

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. 🙂

sheluchin23:03:46

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!

👍 1
sheluchin00:03:21

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.

Leaf Garland01:03:26

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...

👍 1
sheluchin15:03:01

And another dimension to it is that theme support for these features comes in all permutations 😄