This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-10
Channels
- # adventofcode (54)
- # announcements (30)
- # asami (13)
- # aws (10)
- # babashka (16)
- # babashka-sci-dev (44)
- # beginners (95)
- # calva (63)
- # clara (10)
- # clj-kondo (3)
- # cljfx (6)
- # cljs-dev (7)
- # cljsrn (1)
- # clojure (68)
- # clojure-europe (59)
- # clojure-nl (7)
- # clojure-norway (12)
- # clojure-spec (6)
- # clojure-uk (6)
- # clojurescript (4)
- # component (4)
- # conjure (5)
- # datomic (3)
- # deps-new (1)
- # events (4)
- # exercism (1)
- # figwheel-main (1)
- # fulcro (33)
- # gratitude (1)
- # improve-getting-started (3)
- # jobs (3)
- # lsp (5)
- # malli (10)
- # membrane (5)
- # music (3)
- # nextjournal (6)
- # off-topic (42)
- # pedestal (2)
- # polylith (14)
- # portal (11)
- # re-frame (42)
- # releases (3)
- # reveal (4)
- # shadow-cljs (62)
- # tools-build (1)
- # tools-deps (3)
- # web-security (1)
- # xtdb (3)
is there any way to show documentation of a function using only the keyboard I usually hover the mouse over the function name and it pops up, but it will be a bit more practical for me if there is some keyboard shortcut to do it
There’s a VS Code command for showing the hover, I think it is named Show Hover. On Mac it is default bound to cmd+k cmd+i
, maybe on Windows/Linux that’ll be ctrl+k ctrl+i
.
@U0ETXRFEW vscode doesn’t allow “richer” tooltips yet, right? something like a table or graphic i mean
Actually there was a change recently to the markdown allowed in the hovers. It might have opened up for at least slightly richer content. I haven’t investigated yet.
nice, i’ll have to look into that, thank you!
Awesome. What I’d like to know first about that is if we can use detail/summary
tags now. We couldn’t before, and it has stopped me from presenting data structures in a collapsable manner.
uh, i’m sure i don’t know enough about calva to tell you anything about that, but i’ll have a look at the new feature and come back to you
Yeah, it might take some digging in Calva to actually use it. But what you need to know is that we populate the hovers using markdown. And it used to be a pretty limited markdown, where the html tag <details>
couldn’t be used. If that tag can now be used, a nice possibility opens. 😃
so according to this https://github.com/microsoft/vscode/blob/4bc25f73942dbaecaee345b5677f7164f268b193/src/vs/base/browser/markdownRenderer.ts#L360 these are our options: ALLOWED_TAGS: [‘ul’, ‘li’, ‘p’, ‘b’, ‘i’, ‘code’, ‘blockquote’, ‘ol’, ‘h1’, ‘h2’, ‘h3’, ‘h4’, ‘h5’, ‘h6’, ‘hr’, ‘em’, ‘pre’, ‘table’, ‘thead’, ‘tbody’, ‘tr’, ‘th’, ‘td’, ‘div’, ‘del’, ‘a’, ‘strong’, ‘br’, ‘img’, ‘span’], ALLOWED_ATTR: [‘href’, ‘data-href’, ‘target’, ‘title’, ‘src’, ‘alt’, ‘class’, ‘style’, ‘data-code’, ‘width’, ‘height’, ‘align’] no details sadly, but an optional “always details” hover effect, maybe switchable through a hotkey, for inline results would be something i’d use :)
by the way, https://code.visualstudio.com/updates/v1_63#_pre-release-extensions will help with stuff like parinfer testing
We show all details today. The details tag is about hiding them 😃 https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details
ah whups 🙂 i thought you wanted to display it in a rendered way, for example in a table
Yeah, it would be wonderful to present rich results. Just that I think it is almost impossible to consume large result data structures as it is now.
yeah I think most people that active already use portal or reveal for anything that’s not trivial, but that’s sad for any newbie that doesn’t know about them. having some middle ground between a basic repl and a full blow window would be helpful for the beginner experience
just getting a new macbook and rethinking my setup. i am a long time intellij user, but vscode+calva feel like a space where i could contribute more to the dev experience. Are there any roadmaps / docs on calva/vs code extension possibilities ( specially web views) that you could share? many thanks
There’s not really a roadmap, but for contributing to Calva, see here: https://github.com/BetterThanTomorrow/calva/wiki/How-to-Contribute. For general docs on Calva, see http://calva.io.
Clojure characters that are either \{ \[ \< \(
seem to disturb the syntax highlighting, see:
Yeah, I'll post the text, but the text wouldn't have shown the colours 😄 This
(defn get-remaining [open [c & r]]
(if (nil? c)
open
(cond (#{\{ \[ \< \(} c)
(recur (conj open c) r)
(#{\} \] \> \)} c)
(if (= c (matcher (peek open)))
(recur (pop open) r)
nil))))
Shows as :Maybe you have VS Code bracket colors on? I can’t fully reproduce, but this looks a bit funny:
It should be reported on the VS Code repo, I think. There might be something Calva can do about it.
oh yeah, the \{
is blue, and its coloured the closing }
on the set blue, when it should be purple
The cursor is on that empt line. Extra interesting that the bracket matching highlights a yellow and a blue paren. 😃
Dec 10, 2021 11:25:56 AM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 155
Dec 10, 2021 11:27:46 AM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 339
Dec 10, 2021 11:27:46 AM org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer fireError
SEVERE: Unable to invoke no-args constructor for class org.eclipse.lsp4j.ShowDocumentResult. Registering an InstanceCreator with Gson for this type may fix this problem.
java.lang.RuntimeException: Unable to invoke no-args constructor for class org.eclipse.lsp4j.ShowDocumentResult. Registering an InstanceCreator with Gson for this type may fix this problem.
at com.google.gson.internal.ConstructorConstructor$14.construct(ConstructorConstructor.java:228)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:212)
at com.google.gson.Gson.fromJson(Gson.java:963)
at org.eclipse.lsp4j.jsonrpc.json.adapters.MessageTypeAdapter.fromJson(MessageTypeAdapter.java:329)
at org.eclipse.lsp4j.jsonrpc.json.adapters.MessageTypeAdapter.parseResult(MessageTypeAdapter.java:188)
at org.eclipse.lsp4j.jsonrpc.json.adapters.MessageTypeAdapter.read(MessageTypeAdapter.java:123)
at org.eclipse.lsp4j.jsonrpc.json.adapters.MessageTypeAdapter.read(MessageTypeAdapter.java:55)
at com.google.gson.Gson.fromJson(Gson.java:963)
at org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler.parseMessage(MessageJsonHandler.java:119)
at org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler.parseMessage(MessageJsonHandler.java:114)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:193)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.lang.Thread.run(Thread.java:829)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Method.java:566)
at com.google.gson.internal.UnsafeAllocator$1.newInstance(UnsafeAllocator.java:50)
at com.google.gson.internal.ConstructorConstructor$14.construct(ConstructorConstructor.java:225)
... 19 more
Caused by: java.lang.IllegalArgumentException: Class org.eclipse.lsp4j.ShowDocumentResult is instantiated reflectively but was never registered. Register the class by using org.graalvm.nativeimage.hosted.RuntimeReflection
at com.oracle.svm.core.graal.snippets.SubstrateAllocationSnippets.hubErrorStub(SubstrateAllocationSnippets.java:258)
at sun.misc.Unsafe.allocateInstance(Unsafe.java:840)
... 22 more
If you can provide an example project which we can reproduce the issue with then we could troubleshoot further.
sorry peeps, not sure if this is calva specific, but I was wondering what is needed to show the source code of java stuff
like I love checking the source of stdlib functions but sometimes they refer to clojure.lang.RT or java.lang.Number for example
According to the getting started repl it should be possible to peek the source of those too.
i get a tooltip with "no definition found" but it might be an issue with my setup
This happens by default on some systems, I think, but on others they have to be manually added
See this question and responses here: https://github.com/clojure-emacs/orchard/issues/103#issuecomment-764842012
Added a note in the docs pointing to that thread here: https://calva.io/connect/#go-to-definition-not-working-for-java-definitions
mhh, I don’t seem to understand the linked comment. i have src.zip in the lib folder of the jvm install and have read access and cant “go to def” on java.lang.Number for example
I’m not sure what the issue is, but go to def might have a bug from a recent change. See this thread: https://clojurians.slack.com/archives/CBE668G4R/p1639431002408900. I don’t think I’ve ever actually gotten that feature to work (don’t remember if I tried the suggestion in the comment). If it’s working for Clojure defs though, feel free to create an issue in the repo and we can troubleshoot there.
k, going into clojure jars seems to still work, i’ll create an issue. thanks
it’s the strangest thing, it just worked for two things, then i wanted to check my calva version, went back to the file and its broken for everything again, without a reload
https://github.com/BetterThanTomorrow/calva/issues/1436 very strange reproducibility, sometimes it partially works and sometimes not at all
Not sure if this is a Calva question or a clojure-lsp question. How do I find all references of a specific arity of a function?. Right now in Calva, with the cursor on the function name, I can find all references of all arities of the function. I tried placing the cursor between the (
and [
for each arity and searching for references. That didn't show any references, I am guessing that doesn't work.