Fork me on GitHub
#calva
<
2021-12-03
>
JR01:12:52

A month new to clojure and a day new to calva. When I use show call hierarchy, I get a nice call stack with “REFERENCES: CALLERS OF” on the left hand side. But when I click on a function in the call stack, the cursor goes to the defn of the function containing the call, not directly to the function invocation. If the calling function is large or there are multiple invocations in the same function, it’s a little annoying for me to have to search for exactly where the call was made. Is there any way to go directly to a call site?

bringe02:12:59

I’ve never used that feature, but it’s supported by clojure-lsp. @UKFSJSM38 Is there anything we should do on Calva’s side to make this work?

bringe02:12:40

Ah, I see what you mean now

👍 1
bringe02:12:17

I think clojure-lsp needs to return the location of the call site rather than the definition of the function that contains the call.

🙌 1
bringe02:12:38

[Trace - 6:55:45 PM] Received response 'callHierarchy/incomingCalls - (183)' in 3ms.
Result: [
    {
        "from": {
            "name": "three []",
            "detail": "core",
            "kind": 12,
            "tags": [],
            "uri": "file:///Users/brandon/development/clojure-test/src/core.clj",
            "range": {
                "start": {
                    "line": 9,
                    "character": 6
                },
                "end": {
                    "line": 9,
                    "character": 11
                }
            },
            "selectionRange": {
                "start": {
                    "line": 9,
                    "character": 6
                },
                "end": {
                    "line": 9,
                    "character": 11
                }
            }
        },
        "fromRanges": []
    }
]

ericdallo12:12:39

I didn't understand the issue, could you elaborate what clojure-lsp should send diferently?

bringe23:12:15

If I double-click bar in the call hierarchy, the cursor is placed at the beginning of bar on line 7. @U02PB3ZMAHH is saying they’d like the cursor to go to foo on line 8, since the call hierarchy is for foo. In a larger function this is more helpful. You wouldn’t have to search the function body of bar to see where foo is being called.

ericdallo23:12:58

I'm afraid this is not possible the way call hierarchy protocol works, unless there is a specific field for that, I can double check that tomorrow

bringe23:12:04

I see. I just noticed that even in TypeScript projects the same behavior exists (the cursor goes to the definition of the calling function, not the call site of the function at the top of the call hierarchy being viewed).

ericdallo23:12:11

Yeah, it's funny but vscode handles typescript differently not using LSP AFAIK :man-shrugging:

ericdallo23:12:40

It could be something to improved on clojure-lsp, that's why I'll double check

JR01:12:30

I’m used to the this from Intellij/Cursive (evaluating) to wrap my brain around big projects

JR01:12:02

I’d jump back and forth between the caller and callee to try to get an idea of the code flow

JR01:12:36

But I don’t have enough experience with VS Code to know if there’s another way

JR03:12:29

I just found goto references Shift-F12, which looks like it will do the job

ericdallo19:12:10

@U9A1RLFNV I confirmed the behavior and it's indeed possible to achieve that following the protocol, it's just that is not clear this behavior (probably open for other languages decide to handle that diferently), IMO we can change to this behavior as for clojure seems to makes more sense, @U02PB3ZMAHH or @U9A1RLFNV could you open an issue on clojure-lsp please?

bringe20:12:56

@U02PB3ZMAHH If you could do the honors, that would be great.

ericdallo16:12:10

@U02PB3ZMAHH @U9A1RLFNV I fixed this on clojure-lsp master!

catjam 1
JR16:12:56

@UKFSJSM38 @U9A1RLFNV Do you still want an issue opened?

ericdallo16:12:15

It's not needed anymore

✔️ 1
🙌 1
Marc O'Morain09:12:04

https://github.com/BetterThanTomorrow/calva/issues/1269#issuecomment-985332906 Good news! The better error reporting that we’ve added recently has helped someone out!

clojure-spin 1
🎉 1
calva 1
Jack Arrington21:12:22

Hey guys, so I recently upgraded Calva and I'm noticing some weird behavior with parens. Say my cursor is at the point in the first image, and then I press "(". My expected state is the second image (the paren auto-closes), but what I get instead is the third image (no auto-closing of the paren). I really love Calva but this has completely broken my muscle-memory (as well as just being incovenient). Is there someway to switch the old behavior back on?

pez21:12:56

Check your User settings JSON. You might need to remove any “[clojure]” settings there regarding auto-closing brackets.

Jack Arrington21:12:11

Ah, looks like I had ""editor.autoClosingBrackets": "never" in there. I definitely don't remember adding that thinking-face, but thanks @U0ETXRFEW!

pez21:12:22

I’m guessing you briefly had Calva 2.0.227 installed. It manages these settings. And then when we reverted that I think many users get a bit wonky settings…

👍 1
seancorfield21:12:43

In the last few days, VS Code/Calva has been locking up completely on me repeatedly. I think it might be related to a recent version of clojure-lsp but it's hard to tell. The editor becomes completely unresponsive, the clojure-lsp process spins up to 100% CPU and a Code Helper (Renderer) spins up to 150%, then I get an alert that the editor is unresponsive - do I wait to wait, close, reopen.

seancorfield21:12:48

Since it locks up completely, I can't get to the tabs that would show the LSP trace (and if I have that open, I can only see the tail end of some data structure at that point so that doesn't help anyway).

seancorfield21:12:36

I've downgraded Calva to 227. If it locks up again, I'll downgrade LSP, and work backwards to see if I can spot the "bad" combination -- but any debugging pointers would be helpful...

pez21:12:59

You could try set the clojure-lsp path to something gibberish. I think that should disable clojure-lsp. To see if that gets rid of the lock-ups. If it doesn’t, then it is probably something in Calva.

ericdallo21:12:55

when it freezes, check clojure-lsp log via terminal with tail -f /path/to/clojure-lsp.log

1
ericdallo21:12:11

you can set the :log-path as well in the clojure-lsp config