Fork me on GitHub
#lsp
<
2022-03-14
>
orestis14:03:56

Is there a way to turn off "hover" for keywords in lsp? https://clojurians.slack.com/archives/CBE668G4R/p1647252769963059

ericdallo15:03:26

we could do on server side, but not sure it's a good idea, this is mostly a clent UX issue, you could disable on calva or delay it

ericdallo15:03:52

because calva has hover automatically enabled when hovering, for emacs/vim for example this is not true, only when user requests it we show

orestis15:03:35

What is the use case to show documentation on a keyword? Is it metadata etc?

orestis15:03:15

Yeah, I had hovers disabled because it's obtrusive but there's no fine-grained knobs in VSCode, it's all or nothing.

orestis15:03:41

Perhaps Calva needs those knobs, but I wasn't sure if keywords was just noise or if there was something more to it.

ericdallo15:03:58

I still think calva needs it, because even if we disable hover for keywords user can still face those issues in functions and almost anything

orestis15:03:22

Yeah, I think disabling some classes of hovers might make sense (e.g. I don't like clojuredocs popping up all the time)... But I was wondering about keywords, like what's the point of showing info on :div? Genuine question 🙂

ericdallo15:03:20

I can't see a reason easily, probably it could be droped

orestis15:03:31

There might be a thing with fully-namespaced keywords e.g. for re-frame - but I don't use re-frame so not sure what are the various practices there.

orestis15:03:57

Also keywords in theory could have "hierarchies"

ericdallo15:03:39

yes, but for simple keywords, not namespaced, probably no one wants to hover?

ericdallo15:03:52

even so not sure that would avoid vscode hover

orestis15:03:59

I will look into turning this off in Calva and report back 🙂

ericdallo15:03:02

probably it would show a empty hover window

orestis15:03:13

Yeah that's what I fear 😄

ericdallo15:03:53

what happens when you hover over ns symbol of a (ns foo) ?

ericdallo15:03:11

because it would behave the same, we don't have analysis/hover for ns symbol

Lukas Domagala15:03:31

when you hover over ns nothing happens, when you hover over foo you see foo

Lukas Domagala15:03:15

all of those statements go out the window when you connect to a repl though since we then don’t ask LSP anymore and ns returns the ns specialform doc and :div doesn’t return anything…

ericdallo15:03:05

so probably vscode is smart and when there is no hover it doesn't show a empty window

ericdallo15:03:42

So I'm ok dropping simple-keywords from clojure-lsp, although it doesn't fix calva showing hovers all the time issue

Lukas Domagala15:03:55

:thumbsup: Yeah, doing that for simple keywords should be fine. We shouldn’t change LSP too much to fix IDE behavior.

☝️ 1
pez15:03:57

Which isn't so much of an issue, I think. We might need to help people find good settings. But there is not all that much we can do about VS Code UI/Ux. Calva has as few knobs as we can get away with. Each knob adds maintenance and user cognitive load.

Lukas Domagala15:03:37

true, a lot of the calva annoyances are actually vscode problems or default settings that users should change

emacs 1
😂 1
☝️ 1
Lukas Domagala15:03:42

I’ll have to ask @U02G2ADG5S6 for a sabbatical to learn that one 😭

😂 1
Lukas Domagala15:03:40

Plus I don’t think emacs is known for “just use the defaults, no settings needed” …

ericdallo15:03:35

indeed :man-shrugging:

ericdallo15:03:03

at least has options, but it was just a joke

❤️ 1
pez15:03:59

There are always trade-offs. ¯\(ツ)

ericdallo15:03:01

yes, so feel free to open an issue about disabling hover for simple keywords, I think this is the best we can do from clojure-lsp side

orestis16:03:17

I actually see clojure docs when hovering over ns 🙂

😔 1
Leaf Garland03:03:42

In vscode you can also trigger the hover from a key, So you can disable editor.hover.enabled and then create a key binding to editor.action.showHover. Might help to deal with the noise from auto hover.

dharrigan20:03:58

When a textDocument/definition request is sent and the contents (of the defintion) is actually inside a jar, on the response back to the client, is it right that the uri is something like file:///home/david/foo/bar/baz.clj/jar:file:/home/david/.m2/repsitory/library.....?

dharrigan20:03:24

Should it not be jar:file at the start, instead of file:///?

ericdallo20:03:07

I don't recall, but we already had tons of issues about that, probably it's right 😂 but, it also depends on the dependecy-scheme setting, it can be jar or zip

dharrigan21:03:22

I have mine set to jar

dharrigan21:03:16

I've noticed something, that I'm trying to gather some facts on

snoe21:03:33

the jar scheme i believe is set to take advantage of vim's zip reader. basically copied from fireplace originally but it may have changed since.

👍 1
dharrigan21:03:52

What I've noticed is that if I goto definition, first time, it opens up the jar file, then if I go to it again, there is a blank response coming from clojure-lsp (therefore the contents are blank)

dharrigan21:03:17

so, trying to figure out why that is

ericdallo21:03:01

@U11EL3P9U we had a similar issue couple of releases ago on Calva, could you confirm you are using a updated clojure-lsp?

dharrigan21:03:34

yup, using the latest. To be fair, I only just noticed it happening. I would have noticed it earlier (as I jump to jars quite a bit)

dharrigan21:03:03

so, my gut feeling is that something has changed somewhere and it's sufficiently annoying me now to pay some attention to it and try to figure out what has happend 🙂

dharrigan21:03:40

clojure-lsp 2022.02.23-12.12.12
clj-kondo 2022.02.09

ericdallo22:03:20

yeah, odd, could you check client <-> server json logs?

Lukas Domagala22:03:22

Yeah we had that exact same issue. Last time it was based on lsp forgetting the file if it got closed in the editor or something like that? I remember you fixed it in lsp

dharrigan07:03:58

Going to spend a bit of time today to see what is going on.

dharrigan12:03:52

Getting somewhere...definitelysomething bizarre happening with the analysis.

dharrigan08:03:47

For those interested. I solved the issue by using the dependency scheme of zip, not jar.

snoe15:03:14

I suspect the jar problem might be that once you nav outside the project into the temp file, the client decides you're in a different project and gets confused for the next jump.

Lukas Domagala15:03:13

by solved, do you mean you changed it in the Calva source @U11EL3P9U? Or is it your own LSP client?

Lukas Domagala15:03:13

Do you know if nvim is built on top of some client lib or does it do its own LSP thing?

ericdallo15:03:02

it has its own lsp client built-in on nvim

👍 1
dharrigan15:03:28

which I don't use

dharrigan15:03:38

I don't use the built in lsp of nvim

dharrigan15:03:40

I use CoC

👍 1
snoe15:03:46

the ability to navigate into the zipfile scheme tho is pretty vim specific.

dharrigan15:03:34

Indeed, on emacs, the scheme is set to jar apparently.

ericdallo15:03:18

yes, for Calva/Vscode too