This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-20
Channels
- # announcements (3)
- # babashka (7)
- # beginners (36)
- # calva (71)
- # cider (25)
- # clj-commons (5)
- # cljdoc (19)
- # cljs-dev (5)
- # clojure (223)
- # clojure-austin (2)
- # clojure-bay-area (1)
- # clojure-europe (31)
- # clojure-france (6)
- # clojure-nl (2)
- # clojure-norway (19)
- # clojure-spec (13)
- # clojure-uk (7)
- # clojurescript (127)
- # core-logic (2)
- # cursive (21)
- # datalevin (53)
- # datomic (9)
- # emacs (37)
- # events (1)
- # graphql (8)
- # jobs (12)
- # lsp (8)
- # off-topic (92)
- # pathom (49)
- # pedestal (1)
- # polylith (3)
- # re-frame (25)
- # releases (2)
- # sci (11)
- # shadow-cljs (13)
- # vim (10)
Hello, i'm having some issues with neovim and clojure-lsp, specifically with autocompletion. Hopyfully somebody has an idea how to fix this. When i include a lib with an lias symbol it doesn't seem to recognize the relevant namespace when i try to use some of it's functions. Instead it suggests all the clojure function from the stdlib. I.e.
((ns test
(:require [io.pedestal.http :as http]))
(def test
(http/
;; this would suggest functions like -, +, abs, and etc
But then when i would close the expression with a function that doesn't exist lsp would recognize the namespace doesn't have the function. i.e.
(def test
(http/thisdoesntexist))
;; lsp recognizes that the 'thisdoesntexist' function isn't valid
Then when i remove the function and a try a function that actually exists, it does suggest the correct functions. i.e.
(def test
(http/st))
;; lsp now suggests the correct functions, i.e. start and stop.
But if i would define another variable that uses the http
namespace, it again shows the incorrect functions.
I've attached a couple of screenshots to help show what i mean.
Fwiw i'm using the following software & versions:
clojure-lsp 2022.04.18-00.59.32
clj-kondo 2022.04.09-SNAPSHOT
openjdk 18 2022-03-22
OpenJDK Runtime Environment Homebrew (build 18+0)
OpenJDK 64-Bit Server VM Homebrew (build 18+0, mixed mode, sharing)
NVIM v0.7.0
2 things to check:
• Try with parens correctly balanced: (http/ )
not sure that would result on correct results
• Check what server is sending to client, check this section: https://clojure-lsp.io/troubleshooting/#client-server-log
Hi @UKFSJSM38 thanks for your reply. When trying with the parens balanced it does work properly. (i.e. first (def testvar ())
and if i then insert the http/ it gives the proper suggestions.
So it seems this is more of an user error than anything else. It's probably best fixed with a plugin that automatically closes parens for me or something like that.
Thanks for your help :)
Yes, a paredit or something like that would help, I think we could improve on clojure-lsp side, not sure how hard would be since we would not have rewrite-clj nodes correctly because of that code
in clojure-lsp i think we should 1) be notifying the client and not running commands if a command is run against an unparsed ns. i run into this with rename that has a high probability of turning the buffer to garbage. 2) write tests against unparseable code. typically buffers open fine, then a change happens that accidentally kills a paren. so the db has an old version of the code and we return edits based on that.