This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-01
Channels
- # announcements (10)
- # aws (1)
- # babashka (19)
- # beginners (104)
- # calva (50)
- # cider (17)
- # cljs-dev (135)
- # cljsrn (56)
- # clojure (240)
- # clojure-dev (4)
- # clojure-europe (19)
- # clojure-nl (2)
- # clojure-uk (7)
- # clojurescript (22)
- # conjure (2)
- # css (1)
- # cursive (10)
- # data-science (1)
- # datomic (60)
- # emacs (2)
- # events (2)
- # exercism (1)
- # figwheel-main (3)
- # fulcro (13)
- # graalvm (5)
- # gratitude (1)
- # inf-clojure (4)
- # introduce-yourself (5)
- # jobs-discuss (21)
- # lsp (36)
- # malli (6)
- # meander (8)
- # missionary (12)
- # off-topic (14)
- # pathom (13)
- # pedestal (10)
- # polylith (42)
- # re-frame (5)
- # reagent (12)
- # reitit (3)
- # releases (8)
- # sci (10)
- # shadow-cljs (37)
- # sql (5)
- # tools-deps (6)
I always saw in various screenshots the references
just next to a function (and now the tests as well which is very cool), but I never managed to find what's the magic lsp setting to enable that
any idea how to get that to show?
ahh yes amazing
thanks
if I click on it though nothiing happens even if it looks clickable
I never tried to click it. I don't use the mouse a lot except for scrolling in emacs
yeah me neither but since it was clickable I assumed it would allow you to see the references somehow
but anyway already nice to see
I asked about the same recently, can’t remember what was the reason it’s not supported
well I guess it would have just to show the list of links
I like that! I turned it off, when it used to be displayed above the function, but now that it shows the test references (and is less obtrusive), I’ve turned it back on
It’s interesting that there’s an lsp-avy-lens
function, which claims to “Click lsp lens using ‘avy’ package” (it just gives me an error if I try to use it)
one thing I'd always loved to have is the ability to actually jump easily to tests that (even without referencing them directly) test that particular function. That is beyond what LSP can do probably, and I did partially get it working with coverlay.el and cloverage reports, but it just tells you if a line was tested, still can't trace back to where.
Projectile has a function for that (`projectile-toggle-between-implementation-and-test` - C-c p t
by default)
well it just jumps to the test namespace, which could be empty, or you could be calling that function from other test namespaces
so yeah it's not something you can do without detailed output from test coverage reports
but I think it would be nice in general to have smarter tools to analyse how your code actually gets really tested, with maybe a mix of things like portal/reveal, tracing and test coverage reports
For functions, I use consult-xref to filter/select them, so easy to see just the test usages. Doesn’t help with the coverage part though.
The reference and test information is just information, it is not supported to do anything at the moment. There are LSP functions and key binding to go to and list references
yeah sure thanks @jr0cket
and as unrelated thing, what do you do to jump to any var definition in a given project? sometimes I know exactly the var name I want to go and could jump there without passing from the file
@andrea.crotti If on the name of the var, i.e. the name used in a call to that function, then its clj-find-var
which is , g g
or xref-find-definitions
(`, g d` in spacemacs)
Otherwise I would use helm-lsp-workspace-symbol
(`, g s` in spacemacs) and type the name of the var I wanted to visit
I mostly just use find-definitions
although I do like the helm-lsp-workspace-symbol
approach now I have taken another look. I assume there is something similar for ivy
mm xref-find-definitions
requires a TAGS file (I guess I have to set up something else) and I don't use helm anymore.
In theory lsp-find-definition
would be fine, it it could take a string as input, while now it just looks at what's currently under the cursor
@andrea.crotti the lens are clickable but the LSP protocol doesn't allow to anything than call commands (calls that only do side effects), in the case of the references lens, we 'd need to show to user the references and navigate to the selected one, which is not possible with the actual LSP spec :/
ah ok cool thanks
Just noticed that the "Extract function" code action isn't available from within deftest
s. I think it's because it isn't https://github.com/clojure-lsp/clojure-lsp/blob/cfde7c905cf1c743ae2dbbd8b5ff5c771b6a92e8/src/clojure_lsp/refactor/edit.clj#L33. Would it make sense to add deftest
to that set?