Fork me on GitHub
#lsp
<
2024-04-02
>
Thierry08:04:59

Anyone else notice folding stops working in VSCode after clojure-lsp start-up? When I stop the clojure-lsp server via the bottom toolbar folding works again, when I start it, it stops working.

Calva version used: v2.0.433
clojure-lsp version used: 2024.03.31-19.10.13
clj-kondo version used: 2024.03.13

Thierry08:04:29

This must be related to: Support textDocument/foldingRange LSP feature. https://github.com/clojure-lsp/clojure-lsp/issues/1602 How can I disable this?

Thierry08:04:37

I tried adding :folding-range-provider false to my .lsp/config.edn but that didn't help

pez08:04:52

I think it could be that Calva is not registered as a folding provider. (Even if I do not quite understand why that would suddenly matter.) You can set the folding strategy to indentation to enable the old/non-clojure-lsp kind of foldings.

🙌 1
Thierry08:04:58

Thanks, will try that! Funny thing is that it doesnt completely stop working. Already open files with folded sections keep the fold and I can fold/ unfold but already unfolded sections and newly opened files are unfoldable 🤪

Thierry08:04:39

That indeed solves the issue but doesn't explain why tho :melting_face:

pez08:04:43

I see this in the log, which looks fine, I guess.

[Trace - 10:35:10 AM] Sending request 'textDocument/foldingRange - (12)'.
Params: {
    "textDocument": {
        "uri": "..."
    }
}


[Trace - 10:35:10 AM] Received response 'textDocument/foldingRange - (12)' in 2ms.
Result: [
    {
        "startLine": 1,
        "startCharacter": 5,
        "endLine": 1,
        "endCharacter": 37,
        "kind": "region"
    },
    {
        "startLine": 8,
        "startCharacter": 8,
        "endLine": 8,
        "endCharacter": 13,
        "kind": "region"
    }
]
I’m pretty sure something needs to be added to Calva, but I have no clue what.

ericdallo15:04:27

Yeah, not sure what it is, clojure-lsp seems to be returning correct info

ericdallo15:04:14

I think I found the problem

ericdallo15:04:21

Fixed on clojure-lsp master, soon available at #C032YH7P0R2

pez15:04:45

Cool! I was sure this was in the Calva side of things.

ericdallo15:04:20

this feature protocol is pretty simple, I don't think the client needs to do anything fancy

pez16:04:11

Haha, I wasn’t thinking fancy. 😃 Anyway. I think I have confirmed that your fix works now. At least I have foldings with strategy set to auto. And it behaves differently than the indentation option.

ericdallo16:04:30

yes, it fixed the ns on sticky scrolling too

pez16:04:46

Cool. (For those who use stick scroll 😃 )

ericdallo16:04:33

I think I'd be this person if that exists for emacs, (I think it's the only feature I know that emacs lsp doesn't have yet)

ericdallo16:04:51

For big long functions that makes a difference IMO

pez16:04:10

Will you cut a new release? Or, rather, let me know when you have and I’ll update/close the issue on the Calva repo.

ericdallo16:04:44

I'm not planning do a release just because of this fix

ericdallo16:04:59

unfortunately the release process is not as smooth as I'd like

pez16:04:01

I don’t use folding either. So I think I’m just a bit weird.

Thierry16:04:43

Sticky icky, I do use folding though