Fork me on GitHub

By clicking following to definition, vscode shows a library file, cljs.core.async.interop, how can I see other files under the same directory?


There's no way that I know of. We could show where the jar is in the hover, but from there the user would need to figure out the next steps.


Cursive with intellij shows the lib, so can easily navigate the lib files


Cursive is awesome when working with any Java stuff, and IntelliJ has full citizen support for jar files.


better it would be possible to turn on breadcrumbs for library files

🧵 3

I would like that code is not so widely indented when function names are very long and html tree is deep. What is the best solution,

(sui/ui-grid {:columns 2}
                  (sui/ui-grid-row {}
                                   (sui/ui-grid-column {:width 12}
                                                       (div {:style {:width "500px
I don't like that first param is always in a new line.
      {:columns 2}
        {:width 12}


I think I'd like

(sui/ui-grid {:columns 2}
       (sui/ui-grid-row {}
         (sui/ui-grid-column {:width 12}

👍 2

Me too, Is there an elegant way to configure the formatter?


Something like so in whatever file you have configured in calva.fmt.configPath:

{:indents {#"sui/ui-grid.*" [[:inner 0]]}
 :test-code (sui/ui-grid {:columns 2}
              (sui/ui-grid-row {}
                (sui/ui-grid-column {:width 12}
I'm not super savvy with cljfmt config, though. I'd check out

👀 2

As mentions, if you have the cljfmt config file in the workspace, you'll enjoy hot reload. So you can experiment with the settings and reformat the config file itself to check what happens. That's why there's a :test-code entry in my example.


I read this in the user guide about cljfmt, but just don't want to invent my style. It seems i would have too. I was hoping that there is a way to turn on some common and widely accepted style.


The default is the most common and widely accepted style. You can also go for, which is also common, but slightly controversial:

{:indents ^:replace {#"^." [[:inner 0]]}
 :test-code [(sui/ui-grid {:columns 2}
               (sui/ui-grid-row {}
                 (sui/ui-grid-column {:width 12}
             (let [foo bar]
               (str "foo"

👀 2

You are working on large projects, so the formatting style is usually defined per project?


Indeed. If many people are involved is common to bring down diff noise by enforcing project wide formatting.

Lukas Domagala14:04:35

Hey Calva friends, I finally managed to finish adding the locations from lsp and nrepl. If anyone wants to help test it, here’s the preview It shouldn’t break anything, but any performance might be worse. Thanks for helping out!

🚀 3
💜 3
clojure-lsp 3
calva 4
☝️ 1

Calva friends should note that this feature is already in dev, so it will reach all users next time we cut a release, which is later today or tomorrow. So please consider giving the build a spin and help us catch any (unlikely) reasons to hold off the release.


Thanks for doing this work, @domagala.lukas! gratitude 🙏 ❤️ I love how you apply just the right solution to a problem that has been bothering us (maintainers as well as users) for very long, mainly because we haven't figured out a good solution.

💜 2
❤️ 1

Is there documentation about this feature?


No, not sure what we would say. We’re changing internal things.


> but we could provide an options map that lets users decide which provider is used. This lead me to believe there was maybe some user setting involved.


And I was wondering what configuring the setting would look like.

Lukas Domagala19:04:52

@U9A1RLFNV I’ve added the possibility of options, but there’s no way to set them yet. The hope is that the default will be good for everyone, but if it isn’t we can expose them.

👍 1

Sounds good

Jack Arrington15:04:31

Is there any way in Calva to collapse (fold) all the rich comments in a file? I enjoy using them for REPL-driven workflow, but occasionally I just want to view the rest of the code without clutter, and it'd be nice to have a quick way to minimize them all without doing each one manually

Cora (she/her)15:04:34

That would be a great addition to calva! I don't think there's a way to do it right now. you can run Fold from the command palette but that's super manual


There's an extension Fold Plus that almost does this. You can have the cursor on comment somewhere in the file and it will fold all forms that has comment in them. Obviously will fold some other stuff as well, but maybe we should contribute to that extension to add the missing pieces?

Cora (she/her)15:04:11

I love not having to recreate the wheel!


Also, I just tried, with Fold Plus, if you select (comment and then use the command, it will be quite more precise with what is folded.


Is this channel a reasonable place to ask about clojure-lsp implementation/behavior? My purpose in asking is to learn enough to find out whether I want to tackle writing an LSP for a different language than Clojure, so perhaps not the most Clojure-relevant line of questions, let alone Calva.


I think so, or #lsp


Huh, I just tried searching for channels with "lsp" in their name and somehow missed that. I'll ask there.

👍 1

Doh. Didn't finish the search properly. I see it now.

Serafeim Papastefanos19:04:29

Hello friends! can somebody explain to me what would Clover ( offer me over Calva ? (if it offers anything at all)


@U3Y18N0UC probably knows 😊


I use Clover + Calva. Clover is for use with a Socket REPL -- instead of using nREPL/CIDER, which is essentially what Calva uses for a REPL connection.


So I have the nREPL UI disabled in Calva (its a setting) and rely on Calva for all the static stuff: paredit, code insight, syntax coloring, LSP analysis, clj-kondo linting, etc.

💡 1

Then I use Clover for the dynamic stuff: Socket REPL connection, evaluation of code, running tests, etc.

💡 1

Why do I use Clover for that instead of just what is built into Calva? • I run Socket REPLs in a lot of my Clojure processes -- even in production • Using a Socket REPL is built into Clojure -- no dependencies are needed • You can tell any Clojure process to start a Socket REPL automatically via a JVM property at process startup • I want the same editing experience regardless of whether I'm working with a local process or a remote process

💡 2
today-i-learned 1

The other thing I really like about Clover is that you can customize it via ClojureScript: here's my Clover configuration file

👀 2

I use tap> extensively because I also use the Portal extension for VS Code.


That config also includes code to open JavaDocs and ClojureDocs directly inside VS Code in a web browser panel. There's also code to call add-libs (from a branch of tools.deps.alpha to dynamically load new dependencies into a running REPL -- so I update my deps.edn file and highlight the hash map containing the dependencies and then ctrl-; shift-a and those new libraries are loaded into my REPL without a restart.

Serafeim Papastefanos19:04:02

thank you very much for the thorough explanation !

👍 1

I have a couple of videos on my YouTube channel showing my workflow with Atom + Chlorine + Cognitect's REBL which is overall pretty similar to how I now work with VS Code + Clover + Portal (Chlorine is the original version of Clover -- a lot of the same core code is shared between the two different editor plugins).

wow 1
👀 1

A long video of my REPL-Driven Development workflow is shown in this London Clojurians presentation:

thanks3 2
👀 2
Serafeim Papastefanos19:04:22

thank you @U04V70XH6 i'll put it on my to-watch list 🙂


Feel free to DM me with any Qs you have while/after watching it!

🙌 1

Also, Clover does have some somewhat unexplored ways of customizing the way you render your results. You can see some of the work here, on my presentation on Spock, where I do render a chessboard as a result of my code evaluation instead of printing the raw EDN data: I'm using Chlorine on the presentation, but it works on Clover too (as Sean said, they are essentially the same plug-in, with the exception that Chlorine can render results inline, and Clover can't because of VSCode limitations)

👀 2

@U3Y18N0UC Oh, that’s cool! Spock looks incredible, too. Is it similar to core.logic and miniKanren? I have yet to explore logic programming. It blows my mind.


Well, yes and no. Spock is a wrapper over SWI Prolog, so in a way, it's a real prolog programming language inside Clojure. This makes it a little bit hard to coordinate things, but also is a pure-data approach to calling prolog, so it does not depends on macros like core.logic. It's also orders of magnitude faster too (SWI Prolog - there's also an implementation over TuProlog, and that's WAY slower)

💡 1

Hi @U04V70XH6 I am watching the youtube talk you shared. I copied the your dot-clojure deps.edn and tools folder to my .clojure folder. Got hit by a blocker at the first command. Pls advise if I missed anything

WARNING: Specified aliases are undeclared and are not being used: [:new]


That repo has a big disclaimer that it changes all the time. Some aliases have been replaced by tools so it's clojure -Tnew ...

😁 1

You'll need the tools folder from that repo merged with yours, not just the deps.edn file


And make sure your CLI is up to date! I update my dev setup all the time to make it more effective for me.


Noted thank you. I copied tools folder as well


I think the readme has examples of using the tools that replaced the aliases?


$ clojure -Tclj-new create :template application :name cloverclj2/core

Failed with (underlying error, possibly from Maven):
    Failed to resolve version for application:lein-template:jar:RELEASE: Could not find metadata application:lein-template/maven-metadata.xml in local (/home/manas/.m2/repository)

Execution error (ExceptionInfo) at clj-new.helpers/resolve-remote-template (helpers.clj:176).
Could not locate the artifact for template: application
        Tried coordinates:
                {application/clj-template #:mvn{:version "RELEASE"}}
                [application/boot-template "RELEASE"]
                [application/lein-template "RELEASE"]

For more detail, enable verbose logging with :verbose 1, 2, or 3
Got hit by something else. The deprecated RELEASE maven option is used somewhere This did the trick


No idea where you got application from? The clj-new README says clojure -Tclj-new app :name myname/myapp


(! 797)-> clojure -Tclj-new app :name cloverclj2/core
Generating a project called core based on the 'app' template.
# or if you want to use the long form:
(! 798)-> clojure -Tclj-new create :template app :name cloverclj2/core2
Generating a project called core2 based on the 'app' template.
# or use the newer, simpler deps-new version if you don't need Leiningen templates:
(! 799)-> clojure -Tnew app :name cloverclj2/core3
Creating project from in core3


In Calva, I have successfully used F12 (probably default keybindings?) for "Go to definition" on a Clojure function name, and then another keybinding to go back to the previous place in the code, and that even seems to "nest" multiple levels, which is nice. Does anyone know if there is a way on "Go to definition" to cause it to go to the definition in a separate pane or window, leaving the original calling location still visible on the screen? If that were a separate menu item or key binding from the default "Go to definition" behavior, so you could pick which behavior you wanted with different key bindings, that would probably be ideal.

Lukas Domagala00:04:35

I don’t know of a command that does that. Maybe “peek definition” does most of what you need?


It's something like cmd + F12 or some variant of the modifier keys, lmk if that works for ya


On a mac, Cmd-Option-Click on the name of a function opened the definition in a separate window.


I couldn't find any variation of (modifiers) + F12 that did so, but I'm guessing lots of this is configurable.


Not exactly what I was asking for, but very similar. Option+F12 does "Peek definition", which pops up something that I don't know what to call it, but maybe a "sub-window"? That can be scrolled within, and press Escape key to remove it.


Key bindings are very configurable. Cmd+K, Cmd+S brings up a bindings editor.


Personally I have a strong distaste for those peek widgets.

😆 1

@U0CMVHBL2 is opening the def in another window not what you're looking for?


Both peek and opening in another window are both useful to know about. Thanks.

🎉 1

Is there a way to look at bindings for clicking on things, or to change the behavior of what clicks-with-various-modifier keys do? I see the way to customize key bindings that do not involve clicks, but it isn't clear if modifiers+clicks can be redefined.


Yeah not exactly that I know of unfortunately. You can swap which modifier key does the Go To between cmd and opt if you want though lol