Fork me on GitHub
#calva
<
2024-03-13
>
mmer10:03:10

Is there a way to have a project that is targeted at babashka and get the lsp etc to use the bb.edn rather than expecting either a deps.edn or a project.clj

borkdude10:03:42

I think clojure-lsp already respects bb.edn

šŸ™ 2
mmer10:03:34

Ok I will continue and see. Thanks

ericdallo12:03:29

yep, clojure-lsp already does that

wevrem20:03:04

VS Code just made ā€œsticky scrollingā€ on by default, which is sort of cool (or maybe annoying, Iā€™m still deciding), but it makes me wonder how I can get reg-event-fx to be considered part of the outline so it will participate in sticky scrolling?

pez21:03:09

Maybe @UKFSJSM38 is the best person to help with this.

ericdallo21:03:46

could you show a video or so explaining what is that feature?

pez21:03:39

Thereā€™s a demo GIF that the VS Code team made here: https://code.visualstudio.com/updates/v1_70#_editor-sticky-scroll

ericdallo21:03:46

ah cool, interesting

ericdallo21:03:57

how that behaves on clojure right now?

ericdallo21:03:15

is it everything ignored on is there something "sticking" already?

ericdallo21:03:03

if var definitions or namespaces are already sticking, probably they are using the result of the textDocument/documentSymbols from LSP which is a clever idea

ericdallo21:03:28

so we would need just to add keyword definitions there which is a issue opened recently on clojure-lsp, but would be nice to confirm my first question

pez21:03:27

It works on Clojure code. There are three options for what it should use for determining what should stick. Which may be a setting for you to experiment with @UTFAPNRPT.

wevrem22:03:00

I have experimented with the options. Iā€™ll describe what Iā€™m seeing, even though you may have already experimented and already know this. By default (outlineModel) the same items that show up in the outline are the same items that are ā€œstickyā€ when scrolling. Specifically: ns forms act like an ā€œouter wrapperā€ and are always stuck to the top (which Iā€™m still not sure if I like that or not); then defn and def forms are also sticky right underneath the ns form, but they replace each other as you scroll. That is, you only ever have one defn or def stuck right below ns. If I switch to folding or identation, then many more things start to become ā€œstickyā€, and Iā€™m not even sure the distinction between the two, but basically anything that VS Code recognizes as a foldable or collapsible range, the same items where VS Code gives you a disclosure chevron in the left gutter, those all now become sticky. In these two modes, reg-event-fx becomes sticky, but so does a lot of other stuff. Too much, in my opinion. Hence my original question how I could get reg-event-fx to be recognized in the outline, and then it will automatically become sticky.

pez22:03:47

Thanks, @UTFAPNRPT. I havenā€™t experimented much with this. I disabled it after a few days, because it got too confusing to me. It would take me a lot of time to get used to that the lines in visible part of the buffer are from somewhere else in the file. The confusion remained after some days, and remained worse than the benefit I drew from the feature. šŸ˜ƒ

wevrem22:03:23

You have a good point, @U0ETXRFEW. I just noticed it for the first time today (sometimes I am slow to update VS Code), but after updating I certainly did notice it right away, it was obvious that something was definitely different. Iā€™m still trying to decide if I like it or not.

wevrem22:03:19

Iā€™ll keep kicking the tires on it for a few days. Iā€™m not sure how often I get ā€œlostā€ within a single file. Weā€™ll see.

pez22:03:51

If my function takes up more than a screen height, I rather need to fix that than get help with finding my way around in it. šŸ˜ƒ

āœ… 1
pez22:03:15

However, I now sound like I discourage others from using the feature. I have no opinion on what other do! Just reported on my own results from testing it out.

wevrem23:03:08

Keeping functions small is definitely common in Clojure. But Iā€™ve noticed an exception with clojurescript and hiccup. Conceptually the function is small but expressing it in hiccup takes a lot of space.

rayat21:03:19

Bringing the opposing opinion, I love and use this feature. Especially going from js/ts to clj. If the solution to this involves registering reframe keywords as symbols that would be a dream. If then, that would make Go To Definition somehow work (better) for reframe subs/fx/event-fx's I could cry haha. Using kondo to treat them as def* doesn't seem to work very well. Anyways, I'll clarify that I specifically want the stickiness for the reframe stuff

ericdallo12:03:25

would be nice to check if any of these 3 providers use LSP, if yes we can support it indeed

pez12:03:07

The outline model is provided by clojure-lsp, @UKFSJSM38.

ericdallo12:03:28

Do you know by which LSP method?

pez12:03:08

Not really. It just happens, I thought. But I can checkā€¦

ericdallo12:03:36

Please, so we can know for sure where to change and open an issue in clojure-lsp to support that

pez12:03:08

I canā€™t see anything in the Calva code regarding this. The clojure-lsp trace when starting the server looks like so:

[Trace - 1:22:08 PM] Sending request 'initialize - (0)'.
[Trace - 1:22:09 PM] Received response 'initialize - (0)' in 148ms.
[Trace - 1:22:09 PM] Sending notification 'initialized'.
[Trace - 1:22:09 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 1:22:09 PM] Sending request 'clojure/serverInfo/raw - (1)'.
[Trace - 1:22:09 PM] Sending notification 'textDocument/didOpen'.
[Trace - 1:22:09 PM] Sending notification 'workspace/didChangeConfiguration'.
[Trace - 1:22:09 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 1:22:09 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 1:22:09 PM] Received request 'client/registerCapability - (1)'.
[Trace - 1:22:09 PM] Sending response 'client/registerCapability - (1)'. Processing request took 1ms
[Trace - 1:22:09 PM] Sending request 'textDocument/documentSymbol - (2)'.
[Trace - 1:22:09 PM] Sending request 'textDocument/documentSymbol - (3)'.
[Trace - 1:22:09 PM] Received response 'clojure/serverInfo/raw - (1)' in 3ms.
[Trace - 1:22:09 PM] Received response 'textDocument/documentSymbol - (2)' in 8ms.
[Trace - 1:22:09 PM] Received response 'textDocument/documentSymbol - (3)' in 9ms.
[Trace - 1:22:09 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 1:22:09 PM] Sending request 'textDocument/semanticTokens/full - (4)'.
[Trace - 1:22:09 PM] Sending request 'textDocument/semanticTokens/full - (5)'.
[Trace - 1:22:09 PM] Received response 'textDocument/semanticTokens/full - (5)' in 0ms.
[Trace - 1:22:09 PM] Received response 'textDocument/semanticTokens/full - (4)' in 2ms.
And with that I see the outline in the file explorer pane. Nothing is sent to clojure-lsp when I interact with the outline.

pez12:03:45

The items in the outline are called symbols so maybe it is textDocument/documentSymbol?

ericdallo12:03:08

yes, that's my guess too

ericdallo12:03:25

if clojure-lsp doesn't start, does the outline works?

pez12:03:59

clojure-lsp is the only provider. No clojure-lsp, no outline.

ericdallo12:03:42

got it, so makes sense to include that on documentSymbol

pez12:03:39

It would be good is this could be solved in some general way. I.e. not re-frame specific. But I think you are planning something more general, right?

ericdallo12:03:12

yes, there are keyword-definitions analysis which we already use for some features including re-frame support, so the idea is to consider them as well

šŸ™ 1
1