Fork me on GitHub
#vim
<
2021-07-16
>
dharrigan07:07:09

That's pretty neat.

dharrigan07:07:44

There are a few nice things I've seen on emacs, like showing the number of references to a particular function, beside the function. I suppose 'tho, that would be (in my case) a conjure thing to do. (or maybe not, not sure how that would work)

dave11:07:20

coc + clojure-lsp does this out of the box!

Sigve07:07:24

Is the code hosted somewhere? I cannot seem to find it

dharrigan07:07:33

Yeah, I was looking for the github too

Sigve07:07:02

thanks, my search engine did not find it for some reason..

dharrigan07:07:22

You're welcome 😉

dharrigan09:07:46

I wonder if there could be a plugin for neovim + clojure-lsp that shows the references, aka

walterl10:07:14

Just curious, but why is this useful to you?

walterl10:07:36

I care about vars with no references, but now I wonder if I may be missing some trick with the actual ref count.

dharrigan12:07:57

It shows quickly, in a namespace, if it's been used elsewhere

dharrigan12:07:08

that is all. Just a fact, doesn't mean I have to act upon it 🙂

dharrigan12:07:44

(perhaps a fn with too high a reference count, could indicate something important to look at 🙂 )

walterl12:07:31

Got it, thanks 👍

dharrigan09:07:51

which emac'ers see.

Sigve09:07:27

is this something else than coc-references ?

dharrigan09:07:53

It's related to it

Sigve09:07:00

You are talking specifically about the floating text above the function(s)?

dharrigan09:07:24

(and it can appear at the side too)

dharrigan09:07:45

I think perhaps, that may be further extension for the new coc-clojure plugin by @nbtheduke?

dharrigan09:07:24

if you do coc-references, which I map to ,cs for me, it opens up the quickfix window

Sigve09:07:31

i see, that would be neat. Does the text typically flash or stay permanent next to the function?

dharrigan09:07:48

I would suspect permanent, but configurable? I.e., on cursor move, after 500ms, remove it?

Noah Bogart10:07:48

The references appear if you turn on code lens and are running neovim. I’m on my phone so I don’t have the coc setting on hand

dave11:07:30

I have this exact behavior working with coc + clojure-lsp. I believe it just works out of the box, although I may also have something in my config that enables it. Will look soon and confirm.

dharrigan11:07:21

it's probably a setting

dharrigan11:07:44

codeLens.enable on my coc-settings.json

👍 4
Chase16:07:42

I keep getting double warnings and such. I think it is maybe because I have both clj-kondo and clojure-lsp set up in my coc-settings.json. Should I take out the clj-kondo stuff as clojure-lsp is using it?

borkdude16:07:44

Actually that specific warning is only coming from clojure-lsp, not kondo

borkdude16:07:15

The only linter in lsp is currently unused-public-var because clj-kondo doesn't have that one

Chase16:07:41

I also get similar behavior if it's just a clj-kondo lint as well

borkdude16:07:46

if you are using clojure-lsp you can turn clj-kondo off, because clojure-lsp is using clj-kondo for linting as well

👍 3
Chase16:07:41

That's what I was thinking. I should have tested this all myself before bugging you folks. Thanks for the quick response!

Chase16:07:05

Actually, that didn't help. I only have clojure-lsp in my coc-settings.json and am still getting the double warning. Hmmm.

Chase16:07:45

Actually, it's the new coc-clojure plugin that was causing it. @nbtheduke

Noah Bogart17:07:39

do you use ALE? if so, make sure you set the g:ale_linters setting for clojure to [''] , as clojure-lsp uses clj-kondo and doesn’t need a second warning, and let g:ale_disable_lsp = 1 to disable ale’s built-in lsp support so only coc.nvim’s lsp is running

Chase17:07:06

I only use coc.nvim. Maybe it's conjure? Not sure if it's calling out to the lsp

Noah Bogart17:07:12

hmm i’m not sure

Noah Bogart17:07:22

what’s your vimrc?

Noah Bogart17:07:46

You need to remove the clojure-lsp section from your coc-settings.json file

Noah Bogart17:07:56

the coc-clojure plugin supersedes it

Chase17:07:04

that works, cool. Simplifies my config quite a bit then.

Noah Bogart17:07:10

so glad to help!

Chase17:07:14

I noticed you aren't keeping your dotfiles repo on github up to date. I was hoping to be lazy and steal all these new coc-clojure keybindings from you.

Noah Bogart17:07:01

ah damn, true! lemme do that now

Chase17:07:33

lol, sweet

Noah Bogart18:07:48

my vimrc is long and messy, so my apologies

Noah Bogart18:07:10

the coc stuff is mostly copied from the coc.nvim repo

Chase18:07:13

Awesome, thanks for doing that. I was mostly having fun, not asking you to put in the work.

Chase18:07:33

You only have the thread last keybinding anyways it seems. You haven't started using your own fancy new plugin yet, have ya? haha

dharrigan18:07:44

@nbtheduke not all the clojure-lsp from the coc-settings, surely?

Noah Bogart18:07:28

haha I only defined that one to test it out! I just run the code actions or CocCommands to do stuff normally

dharrigan18:07:43

for example, my coc-settings, I have this:

dharrigan18:07:44

"languageserver": {
    "clojure-lsp": {
      "command": "clojure-lsp",
      "filetypes": ["clojure"],
      "disableDiagnostics": false,
      "rootPatterns": ["deps.edn", "project.clj"],
      "additionalSchemes": ["jar", "zipfile"],
      "trace.server": "verbose",
      "initializationOptions": {
        "project-specs": [
        {
          "project-path": "deps.edn",
          "classpath-cmd": ["clj", "-Spath"]
        },
        {
          "project-path": "project.clj",
          "classpath-cmd": ["lein", "classpath"]
        }],
        "use-metadata-for-privacy?": true,
        "ignore-classpath-directories": true
      }
    }
`

dharrigan18:07:57

In what you say above, you say remove the clojure-lsp section from the coc-settings

Chase18:07:08

Ahh, I didn't think of that. I removed it wholesale cuz I only had the base settings copy and pasted in there. I didn't have it customized

dharrigan18:07:30

Right, so, how does that work with the coc-clojure plugin now?

Noah Bogart18:07:40

good point, i’ll update the readme

Noah Bogart18:07:30

the languageserver object in coc-settings.json is for defining ad-hoc lsps, so it lets you define the lsp-specific settings there and some various coc.nvim specific settings for defining an lsp

dharrigan18:07:56

Is that section, therefore, not required if using the coc-clojure plugin?

dharrigan18:07:36

And if so, how do I then pass enable things like rootPatters, tracing the server, and ensuring the diagnostics are not disabled (which will cause the interaction with clojure-lsp and clj-kondo to fail)

Noah Bogart18:07:43

right, it’s not. if you want to carry some of those settings over, you define them in the base coc-settings.json object:

"clojure.executable": "/Users/noah/Personal/clojure-lsp/clojure-lsp",
    "clojure.startup-message": true,
    "clojure.trace.server": "verbose",
    "clojure.initialization-options.text-document-sync-kind": ":incremental",
    "clojure.initialization-options.use-metadata-for-privacy?": true,
    "clojure.initialization-options.ignore-classpath-directories": true,

dharrigan18:07:16

and the project-specs?

Noah Bogart18:07:46

either define them locally (project/.lsp/config.edn) or globally (~/.lsp/config.edn) or rely on the defaults https://github.com/clojure-lsp/clojure-lsp/blob/96c5e5b60b0c5ca6d772572a56e513321728088f/src/clojure_lsp/crawler.clj#L58-L67

Noah Bogart18:07:36

i think i left that out cuz i couldn’t figure out how to write it in the coc settings definition language, but we’ll see

Noah Bogart18:07:50

def gotta be explicit about these options

dharrigan18:07:23

Looks like my project specs aren't required, as those are the defaults anyway!

👍 2
dharrigan18:07:57

I wish there was a central place that contains all the configs everywhere, curated to be the best possible experience....

Noah Bogart18:07:09

yeah that would be great 😞

dharrigan07:07:24

@nbtheduke can I pick up on something again as I'm trying to understand. Let's say I want to have this option carried forward "disableDiagnostics". I had this in my language server clojure-lsp block (see previously). Looking though the code, of coc-clojure, I notice that you gather up all the values of the clojure.initialization-options, here , then you pass them through to the language server as client options here, . Does this mean, that, I would need to do clojure.initialization-options.disableDiagnostics: false in order for that option to be preserved as I had before? Thank you.