vim

For discussion on all things (neo)vim.
pseud 2021-01-30T14:13:02.033700Z

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.

dharrigan 2021-01-30T16:09:32.034400Z

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

dharrigan 2021-01-30T16:10:27.034700Z

This is my setup for the languageserver:

dharrigan 2021-01-30T16:10:29.034900Z

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

👍 1
dharrigan 2021-01-30T16:10:55.035300Z

I have the latest clojure-lsp in my path

dharrigan 2021-01-30T16:12:55.036500Z

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

dharrigan 2021-01-30T16:13:32.037300Z

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.

dharrigan 2021-01-30T16:15:03.037900Z

I think project-specs makes the difference...

dharrigan 2021-01-30T16:15:22.038200Z

<https://clojure-lsp.github.io/clojure-lsp/settings/>, it teaches LSP to trawl through the dependencies

pseud 2021-01-30T17:19:14.038300Z

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