This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-26
Channels
- # asami (3)
- # babashka (3)
- # beginners (45)
- # boot (3)
- # calva (6)
- # clojure (26)
- # clojure-dev (16)
- # clojure-europe (15)
- # clojure-norway (6)
- # clojure-uk (6)
- # clojurescript (34)
- # community-development (4)
- # conjure (3)
- # datascript (4)
- # datomic (4)
- # emacs (21)
- # events (1)
- # fulcro (16)
- # graalvm (5)
- # jackdaw (1)
- # kaocha (5)
- # lsp (74)
- # malli (8)
- # nbb (37)
- # off-topic (50)
- # pathom (5)
- # reagent (19)
- # ring (1)
- # shadow-cljs (60)
- # sql (3)
For this code:
(defn foo []
"baz")
(comment
(foo))
#_(foo)
If I am on the (foo)
in the comment block, go to definition works. However, if my cursor is on the (foo)
in the last line, go to definition fails (`[coc.nvim] definition not found`). Is it possible to support go to definition from forms in a discard?It'd be a little bit harder as we would need to clj-kondo provide analysis for commented forms, but sounds possible. Not sure how common would be that too... WDYT @U04V15CAJ?
I tend to use discard forms instead of comment forms for Rich Comments as my editor/plugin has a very-useful “eval top-level form” command that lets me run code without moving my cursor to a specific location. I don't know how common my use case is.
Clj-kondo already provides analysis for that unless you disable that with skip-comments true
@U0510902N For comparison, Calva treats forms inside comment
as top-level forms so the usual shortcut for eval works (even tho' they are not really top-level forms). Perhaps you could petition the coc.nvim
maintainer(s) to add support for that too?
@U04V70XH6 that's awesome. Conjure (my repl plugin) is getting closer to supporting that reliably. It works for me sometimes, could be related to a Neovim bug.
I just did lsp-clojure-server-info
and I see this entry:
> :port “NREPL only available on :debug profile (`make debug-cli`)“,
what’s the story of this? Is this an nrepl port to lsp itself or can you pass a port to lsp of the running project?
neat. I was wondering if you could provide a port to your running repl. Would be awesome if i could tell it there’s a socket repl at 50505 and it can query all it likes
I updated to the latest version 2022.07.24-18.25.43
so I could try out the experimental scanning feature, but I haven't enabled it yet. I did notice that the startup status messages don't seem to be coming through. Were they removed?
https://clojurians.slack.com/archives/CPABC1H61/p1658420445355509?thread_ts=1658420445.355509&cid=CPABC1H61 it works on the previous coc.nvim release
It looks like the coc.nvim project globally disabled startup progress indicators recently. I was able to get the progress back by adding:
"progressOnInitialization": true
to the clojure-lsp language server config. Here's the https://github.com/justone/dotfiles-personal/commit/e5a9934163ba40f27a789e2f867df663d946add7 for reference.
Now the progress shows up in the lower right as a not-too-pretty-but-very-useful popup.https://github.com/justone/dotfiles-personal/commit/a3b5ae95461488a460057cf0b157b0c8167220c5 to remove the rounded corners makes the popup look ok:
It looks like the coc.nvim project globally disabled startup progress indicators recently. I was able to get the progress back by adding:
"progressOnInitialization": true
to the clojure-lsp language server config. Here's the https://github.com/justone/dotfiles-personal/commit/e5a9934163ba40f27a789e2f867df663d946add7 for reference.
Now the progress shows up in the lower right as a not-too-pretty-but-very-useful popup.I've noticed when I have something like (:require [
I don't get autocompletion/doc suggestions from the LSP when I am writing something like (io/| )
in the source file where |
is my cursor position. I do get such help if I write out the whole (
and I do get such help if I've required [clojure.string :as s]
and am writing something like (s/| )
. I haven't tracked down which ones this works for and which it does not but just curious if this is a known issue? Or is it a specific editor issue? (I'm using neovim w/ conjure and coc.nvim).
clojure.string working and http://java.io not is weird. Could you create a repro sample where I can try?
In trying to make that little sample repo for you, I'm getting slightly different behavior. The (s/|
automatically pops up with suggestions with a [LS]
designation as the source, but if I do (io/|
and then press TAB
I do now get the suggestions with a [CLJ]
source.
Not sure what is that, probably something from your editor, but I'd guess one is from the LSP and the other from the repl or built-in editor
Unless I have already written something like (io/reader ...)
before because then it autosuggests that only with the [A]
source which I think means it's just reading the file for current suggestions.
I think the multiple :resolve-completion-item
was when I was TAB
-ing through the suggestions for (s/|
and then after that I tried with (io/|
So if I had to guess, the LS
is giving the suggestions for clojure.string
and then the repl/editor is giving the spotty suggestions for
even when using the full namespace instead of just (io/
@U9J50BY4C from the logs we can see clojure-lsp is returning completion items, which looks correct. Is there a repro where I can try?
Hmmm. Are you asking for me to get a setup on github for neovim with conjure and coc.nvim configurations? I'm not sure how that would work. Otherwise, I would just be putting up a bare bones clojure repo that requires in [
. No worries though, it might just be some silly thing I have in my setup, I wouldn't want you spending a lot of time on that.
I just need the project so I can try exactly what you are trying and check if the project setup is correct
Here ya go: https://github.com/Chase-Lambert/clojure-scratch I feel like I'm already taking up too much of your time though
it seems to work on emacs, so maybe something with vim? could you get logs between client and server https://clojure-lsp.io/troubleshooting/#client-server-log
I'll work on getting that for you. I'm also asking in #conjure to see if this is just my setup or if others are seeing the same issue.
I think this is the log you are looking for?
2022-07-27T12:08:45.809 INFO (pid:2543) [services] - registered service "languageserver.clojure-lsp"
2022-07-27T12:08:45.818 INFO (pid:2543) [coc-conjure] - CoC conjure enabled!
2022-07-27T12:08:45.839 INFO (pid:2543) [plugin] - coc.nvim initialized with node: v18.4.0 after 224ms
2022-07-27T12:08:57.371 INFO (pid:2543) [services] - clojure-lsp state change: stopped => starting
2022-07-27T12:08:57.398 INFO (pid:2543) [language-client-index] - Language server "languageserver.clojure-lsp" started with 2742
2022-07-27T12:08:59.501 INFO (pid:2543) [services] - clojure-lsp state change: starting => running
2022-07-27T12:08:59.543 INFO (pid:2543) [services] - service languageserver.clojure-lsp started
2022-07-27T12:09:15.101 WARN (pid:2543) [completion] - Suggest not triggered with input "", minimal trigger input length: 1
2022-07-27T12:09:15.102 WARN (pid:2543) [handler-format] - Format on type provider not found for buffer: file:///home/chaselambert/projects/clojure/scratch/src/scratch/core.clj
2022-07-27T12:09:23.608 INFO (pid:2543) [attach] - receive notification: startCompletion [
{
word: 'io/',
bufnr: 3,
col: 1,
disabled: [],
filepath: '/home/chaselambert/projects/clojure/scratch/src/scratch/core.clj',
indentkeys: '',
blacklist: [],
line: '(io/)',
filetype: 'clojure',
linenr: 6,
input: 'io/',
colnr: 5,
changedtick: 489
}
]
2022-07-27T12:09:39.062 INFO (pid:2543) [attach] - receive notification: openLog []
No, it should be a log which logs whant client and server are sending and receiving, usually as json
I can open it in the editor using the command the coc.nvim
docs told me to use but I don't know where that file is quite yet. lol sorry give me a second
I think it's best to restart the server, repro the bug and then get the log, to avoid too many logs
Yeah, I've done that. It's still 1200 lines but I just can't figure out how to save it or find it in my system. It's like a temporary vim buffer that disappears showing at output:///languageserver.clojure-lsp
Sorry about this, I'm trying to figure it out
I guess I have the tracing log set to "verbose" I can change that and give you a smaller log.
hmmm, maybe it's trying autocompletion too quickly then. I'm definitely getting the cursor to (io/
and just letting it sit there. Someone else on the #conjure channel is seeing the same behavior.
From the logs, this is the code sent on the last didChange request:
(ns scratch.core\n (:require \n [ :as io]))\n\n(i)\n\n\n(defn -main [])\n
Also, check if there is no flag to disable client completion cache if any, just to confirm there is nothing wrong on server side but on client
I have to step away for a brief moment. When I get back I'll look for that client completion cache
stuff
So I imagine something is going on with coc.nvim
and the language server. or the way conjure
brings them both together.
I'm seeing the same behavior with s
vs string
with the former completing and the latter not, very odd
I think I tracked it down to a recent change in coc.nvim
. I did some git bisecting to weed out the commit where it stops working. See this thread in #conjure: https://clojurians.slack.com/archives/CK143P6D7/p1658963667671899
nice find; for completion I often find I have to manually trigger around /
with this from the coc doc
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
I am now curious to compare the LSP experience with coc.nvim vs the inbuilt tools. I've been fighting off making the switch to a lua (or maybe even fennel) config but that could change if coc.nvim is starting to fall behind the LSP integrations of the "native" solution. Of course if it's just a tiny bug I could be making a mountain out of a molehill here
I suspect they both have tradeoffs; most clients do as they are all trying to play catch up with vscode and the spec and fit it into their editor's quirks.
Just for closure, this problem seems to have fixed itself when updating to the latest version of coc.nvim
. (Also note that that update does include some frustrating breaking changes to the autocompletion workflow but it was decently easy to fix by using the changed example config on the main repo README.md. https://github.com/neoclide/coc.nvim/releases/tag/v0.0.82)
Thanks for the update @U9J50BY4C!