Fork me on GitHub

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?


it's code lens


lsp-lens-enable t


ahh yes amazing


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


makes sense yeah, don't know


I asked about the same recently, can’t remember what was the reason it’s not supported


perhaps because it's ambiguous to what it should navigate to


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


Oh, yes - it’s for the namespace, not the specific function


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


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 deftests. I think it's because it isn't Would it make sense to add deftest to that set?


Feel free to open an PR more tests!


Will do, thanks!