This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-15
Channels
- # asami (6)
- # babashka (74)
- # babashka-sci-dev (164)
- # beginners (50)
- # biff (3)
- # calva (71)
- # clj-kondo (4)
- # cljdoc (39)
- # cljsrn (4)
- # clojars (8)
- # clojure (70)
- # clojure-austin (7)
- # clojure-czech (5)
- # clojure-europe (4)
- # clojure-losangeles (1)
- # clojure-nl (10)
- # clojure-norway (1)
- # clojure-uk (3)
- # clojurescript (38)
- # community-development (18)
- # cursive (129)
- # datomic (9)
- # fulcro (7)
- # graalvm (4)
- # improve-getting-started (1)
- # jobs (1)
- # kaocha (2)
- # liberator (9)
- # lsp (22)
- # malli (3)
- # membrane (95)
- # off-topic (86)
- # releases (2)
- # sci (5)
- # specter (2)
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 is awesome when working with any Java stuff, and IntelliJ has full citizen support for jar files.
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.
(sui/ui-grid
{:columns 2}
(sui/ui-grid-row
{}
(sui/ui-grid-column
{:width 12}
I think I'd like
(sui/ui-grid {:columns 2}
(sui/ui-grid-row {}
(sui/ui-grid-column {:width 12}
...)))
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 https://github.com/weavejester/cljfmt.As https://calva.io/formatting/ 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 https://tonsky.me/blog/clojurefmt/, 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"
"bar"))]}
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.
Hey Calva friends, I finally managed to finish adding the https://github.com/BetterThanTomorrow/calva/issues/1498 locations from lsp and nrepl. If anyone wants to help test it, here’s the preview https://output.circle-artifacts.com/output/job/9b33bd43-135b-46b2-8a3b-478b86cc6250/artifacts/0/tmp/artifacts/calva-2.0.267-pull-1596-a73d9071.vsix. It shouldn’t break anything, but any performance might be worse. Thanks for helping out!
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! 🙏 ❤️ 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.
> 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.
@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.
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
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?
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.
Thanks for doing this work, @domagala.lukas! 🙏 ❤️ 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.
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.
Huh, I just tried searching for channels with "lsp" in their name and somehow missed that. I'll ask there.
Doh. Didn't finish the search properly. I see it now.
Hello friends! can somebody explain to me what would Clover (https://marketplace.visualstudio.com/items?itemName=mauricioszabo.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.
Then I use Clover for the dynamic stuff: Socket REPL connection, evaluation of code, running tests, etc.
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
The other thing I really like about Clover is that you can customize it via ClojureScript: here's my Clover configuration file https://github.com/seancorfield/vscode-clover-setup/blob/develop/config.cljs
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.
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).
A long video of my REPL-Driven Development workflow is shown in this London Clojurians presentation: https://www.youtube.com/watch?v=gIoadGfm5T8
thank you @U04V70XH6 i'll put it on my to-watch list 🙂
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: https://youtu.be/_8z1r8KV9uk?t=1052 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)
@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)
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 ...
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 trickNo 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 org.corfield.new/app in core3
thank you
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.
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.
@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.
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.