This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-18
Channels
- # adventofcode (26)
- # announcements (3)
- # babashka (12)
- # beginners (20)
- # biff (33)
- # cider (4)
- # clj-kondo (9)
- # cljdoc (17)
- # clojure (35)
- # clojure-art (6)
- # clojure-belgium (1)
- # clojure-denmark (1)
- # clojure-europe (1)
- # clojure-norway (25)
- # clojurescript (29)
- # conjure (19)
- # cryogen (1)
- # datomic (23)
- # honeysql (2)
- # java (3)
- # joyride (9)
- # lsp (24)
- # malli (3)
- # nbb (2)
- # off-topic (25)
- # pathom (2)
- # pedestal (8)
- # portal (1)
- # practicalli (7)
- # re-frame (1)
- # reitit (4)
- # releases (1)
- # shadow-cljs (14)
I’m playing around with nvim-cmp and cmp-conjure. I’m trying to find the minimum configuration to have docstrings display but am having no luck.
In my init.vim
file, I have set completeopt=menu,menuone,noselect
and then require a minimal nvim-cmp setup file written in Lua. All it has is this:
local cmp = require("cmp")
cmp.setup({
window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
end
end, {
"i",
"s",
}),
}),
sources = cmp.config.sources({
{ name = "conjure" },
})
})
When I’m in a Clojure file with Conjure connected to a running nREPL server, I get the autocomplete menu but no documentation displays for the options as I scroll through them.
Am I wrong in thinking this is something I should be able to see with just these plugins and Conjure?
i think you need to add capabilities
to the lspconfig status call with the default capabilities. I have this in my conf: https://github.com/lispyclouds/dotfiles/blob/main/nvim/lua/lsp.lua#L41-L45
Thanks for the quick reply! That means I need to be running an LSP as well, right? I’m not doing that at present.
yeah this will talk to the lsp to get it, not sure if conjure itself can do it
i think this is an nvim-cmp and lsp thing, not related to conjure
probably its making the vim.buf.lsp.hover
call
Yeah, I’m curious as to whether Conjure can do it by itself. https://github.com/PaterJason/cmp-conjure/blob/d76e1fe5d724afe604dfa7b4b5ba93f3d3730617/lua/cmp_conjure/init.lua#L58-L60 it looks like Conjure is what returns the information.
yeah i suppose you need to have an nREPL thing running then? not sure how Conjure does its thing but something needs to parse the clojure code
And it’s a memory constrained system so I’m trying to limit this to the minimum necessary components. Thanks for your suggestion, though, I’m looking more into the cmp-nvim-lsp plug-in to see if there’s something there 🙂
well the lsp should take less resources 😆 lsp along til you really need the JVM
True 😄 In this case, though, I need the nREPL server running so am seeing how much I can leverage that.
It feels like it should be able to do everything since all I really want it to display is the docstring and it’s more than able to look that up.
yeah, this is pretty much my limits of understanding of things from a user perspective. yeah conjure should be able to do it, given that it predates lsp
kinda shows how much ive come to take lsp for granted 😅
The problem was a consequence of only using nREPL without the CIDER middleware. If I put the following as an alias in my deps.edn
then suddenly it all works as expected:
:nrepl {:extra-deps {cider/cider-nrepl {:mvn/version "0.29.0"}}
:main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}
The problem was a consequence of only using nREPL without the CIDER middleware. If I put the following as an alias in my deps.edn
then suddenly it all works as expected:
:nrepl {:extra-deps {cider/cider-nrepl {:mvn/version "0.29.0"}}
:main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}