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.Works for me. Let's see if I can help
This is my setup for the languageserver:
"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
}
}
}
I have the latest clojure-lsp in my path
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)
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.
I think project-specs
makes the difference...
<https://clojure-lsp.github.io/clojure-lsp/settings/>
, it teaches LSP to trawl through the dependencies
Hey 🙂 Thanks for taking the time. I'll git it a whirl..!