This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-09
Channels
- # announcements (17)
- # babashka (8)
- # beginners (68)
- # calva (28)
- # clj-kondo (36)
- # cljsrn (1)
- # clojure (232)
- # clojure-dev (3)
- # clojure-europe (13)
- # clojure-nl (14)
- # clojure-spec (9)
- # clojure-uk (11)
- # clojuredesign-podcast (3)
- # clojurescript (38)
- # core-async (3)
- # cursive (1)
- # datahike (4)
- # datomic (4)
- # fulcro (56)
- # graphql (1)
- # helix (3)
- # honeysql (5)
- # introduce-yourself (1)
- # kaocha (2)
- # lsp (67)
- # malli (7)
- # meander (2)
- # off-topic (1)
- # pathom (9)
- # re-frame (55)
- # reitit (3)
- # releases (8)
- # remote-jobs (12)
- # shadow-cljs (12)
- # sql (3)
- # tools-deps (55)
- # vim (5)
- # xtdb (3)
Is clojure-lsp sending semantic info to the client?
i think so
how would i enable it?
also, if you use lsp-mode, you need to enable there as well with (setq lsp-semantic-tokens-enable t)
interesting. i’m seeing it happen without setting anything in coc.nvim
so even tho it’s disabled by default in clojure-lsp, if coc.nvim asks for it, clojure-lsp will provide it?
huh i wonder what’s happening then
ah perfect, thank you so much. it’s a cool feature, just caught me off guard when all of the colors i’ve meticulously set up suddenly changed, hah
They are configurable on client side (at least lsp-mode), so you change for what you want
yeah, i found the coc.nvim settings for disabling or configuring it. thanks for the quick responses!
i have feedback/questions about how the semantic data is generated. is this a good space to ask those questions?
cool. i’m referring a defonce
map from another namespace into my namespace: (:require ... [web.config :refer [server-config]] ...)
and the server-config
is being colored as a function (instead of a symbol). i opened the log and found the place where clojure-lsp is sending the info, and coc.nvim is interpreting as a function: "CocSem_function"
. if i enter the web.config
namespace, the (defonce server-config ...)
is correctly marked as a normal symbol.
is this a bug? should clojure-lsp be finding out the type of a given referred symbol before marking it as a given LSP type?
this is definitely clojure-lsp setting it as a function as it's a var-usage from clj-kondo eyes, maybe we can fix that if we somehow know that the server-config is a map and not a function
I'm not sure how to call it from vim, but it should bring info for the cursor, so we can debug and understand it
lemme see what i can do to call that
it seems i can’t send custom commands to the lsp through coc.nvim. is there a way i could send it through the command line?
I think that is possible via coc, @U11EL3P9U used to do that
hm okay, must not be looking in the right place. thanks
Something like this: https://github.com/dharrigan/vimconfig/blob/b06d94d456bcc595baa307361428129428123316/custom/600-mappings.vim#L130
excellent find, thank you
yeah, it’s really opaque
okay, got it working! you’re awesome
what info do you need?
nice, so, you can move your cursor to the server-config
that has the wrong color and call cursor-info
{:element
{:fixed-arities #{1},
:name-end-col 41,
:name-end-row 11,
:name-row 11,
:name acknowledged?,
:filename "/Users/noah/Personal/netrunner/src/clj/web/auth.clj",
:from web.auth,
:col 28,
:name-col 28,
:bucket :var-usages,
:row 11,
:to monger.result},
:definition nil}
oops, wrong spot, lol
{:element
{:name-end-col 38,
:name-end-row 15,
:name-row 15,
:name server-config,
:filename "/Users/noah/Personal/netrunner/src/clj/web/auth.clj",
:from web.auth,
:col 25,
:name-col 25,
:bucket :var-usages,
:row 15,
:to web.config},
:definition
{:end-row 13,
:name-end-col 25,
:name-end-row 13,
:name-row 13,
:ns web.config,
:name server-config,
:defined-by clojure.core/defonce,
:filename "/Users/noah/Personal/netrunner/src/clj/web/config.clj",
:col 3,
:name-col 12,
:end-col 59,
:bucket :var-definitions,
:row 13}}
alright, so IMO everything looks correct, from the point of view of the definition, the server-config
is a definition of something (it doesn't matter if it's a map or function)
and the usage is the same, the color should not change as it's a var-usage, it's not related with the val of the definition, but if it's a usage or not
interesting
seems like var-usage-element->absolute-tokens
is overeager in assigning everything to function
?
as a demonstration, here’s a portion of my project.clj:
and output from hovering differ
:
{:element
{:name-end-col 25,
:name-end-row 14,
:name-row 14,
:name differ,
:filename "/Users/noah/Personal/netrunner/project.clj",
:from user,
:col 19,
:name-col 19,
:bucket :var-usages,
:row 14,
:to :clj-kondo/unknown-namespace},
:definition nil}
and hovering stylefruits/gniazdo
:
{:element nil, :definition nil}
Hum, yes, in that case it should return no token or a specific one, maybe requires should be considered as symbols indeed
in this case, they are (or should be), namespace-usages, so namespace is a better token for that
oh, clj-kondo didn't find the cheshire
namespace, that's why it was considered a var-ussage
:to :clj-kondo/unknown-namespace
but agree, clojure-lsp should not return those tokens as var-usages if the :to
= :clj-kondo/unknown-namespace
. feel free to open an issue related to that
if i put the groupId of “cheshire” in so it’s cheshire/cheshire
, it stops being highlighted. however, if i change the groupId/namespace to anything a/cheshire
, it also stops being highlighted
i love it too, and i’d love to see it work better, cuz it could be really powerful
how much detail do you need in this issue?