Fork me on GitHub
#vim
<
2021-01-30
>
pseud14:01:02

Hey. Have run into trouble with Conqueror of Completion (CoC) and clojure-lsp. No matter what, gd prints [coc.nvim] definition not found. clojure-lsp is installed in my $PATH and my :CocConfig looks like so:

{

    // in case both conjure & coc (LSP) provides suggestions, use Conjure's
    "coc.source.conjure.priority": 999999,
    "languageserver": {
        "clojure": {
            "command": "bash",
            "args": ["-c", "clojure-lsp"],
            "rootPatterns": ["deps.edn"],
            "filetypes": ["clojure"],
            "trace.server": "verbose",
            "additionalSchemes": ["jar", "zipfile"],
            "initializationOptions": {
                // don't include resources folders when searching for definitions etc
                //"ignore-classpath-directories": true,
                //
                //"source-paths": ["src/clj", "src/cljs"],
            }
        }
    }
}
In addition, I'm also using coc-conjure-olical. I'm hoping to get coc + clojure-lsp working mainly because Conjure's "go to definition" (`<localleader>gd`) is quite slow, 1.5-2s per lookup and it is something I frequently do. EDIT: Using clojure-lsp release https://github.com/clojure-lsp/clojure-lsp/releases/tag/2021.01.28-03.03.16 EDIT: FWIW -- lookup inside the project source code actually works, tried by cloning clojure-lsp itself. Anything belonging to a library (supposedly) and/or clojure core, does not, however.

dharrigan16:01:32

Works for me. Let's see if I can help

dharrigan16:01:27

This is my setup for the languageserver:

dharrigan16:01:29

"languageserver": {
    "clojure-lsp": {
      "command": "bash",
      "args": ["-c", "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
      }
    }
  }

👍 3
dharrigan16:01:55

I have the latest clojure-lsp in my path

dharrigan16:01:55

I fired up my REPL inside my project directory, opened up neovim, let the languageserver initialise, then mapped goto definition like this nmap <silent> hd <Plug>(coc-definition) (as I have gd mapped in conjure atm)

dharrigan16:01:32

opened up a random file in my source, placed the cursor over the function name, typed in hd and the source opened up in a new buffer.

dharrigan16:01:03

I think project-specs makes the difference...

dharrigan16:01:22

, it teaches LSP to trawl through the dependencies

pseud17:01:14

Hey 🙂 Thanks for taking the time. I'll git it a whirl..!