This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-19
Channels
- # announcements (1)
- # babashka (40)
- # beginners (84)
- # biff (46)
- # calva (37)
- # cherry (2)
- # cider (18)
- # clj-otel (5)
- # clojure (53)
- # clojure-europe (39)
- # clojure-hungary (12)
- # clojure-norway (40)
- # clojure-sweden (2)
- # clojure-uk (2)
- # clojurescript (6)
- # community-development (21)
- # cursive (28)
- # data-science (12)
- # datomic (3)
- # figwheel-main (2)
- # fulcro (12)
- # graalvm (7)
- # gratitude (1)
- # hyperfiddle (23)
- # integrant (9)
- # jobs (2)
- # leiningen (4)
- # lsp (8)
- # malli (3)
- # missionary (1)
- # off-topic (39)
- # polylith (3)
- # portal (33)
- # practicalli (4)
- # re-frame (3)
- # releases (1)
- # sci (53)
- # solo-full-stack (8)
- # sql (5)
- # timbre (9)
I'm developing an electron app with calva, but somehow println output has stopped showing up in the output.calva.repl, repl is working great, eg. evalling :hello or (+ 1 1) shows in the output, but (println "hello") doesn't and it used to?
Are you using shadow-cljs for that app? Can you enable the nrepl message log (there’s a Calva command for that) and see if the messages are there? Do you know when it used to do this?
We added a setting a while ago for redirecting output to the REPL window. It should have nothing to do with this behaviour, but disabling that will restore the old behaviour (after restart of the REPL). You could try it just so that we can rule out that change as the culprit.
<- received { id: '95', ns: 'tab-backend.test.from-excel', session: '49ba1773-57a3-4bed-a739-2656fd0fa6a1', value: 'nil' } <- received { id: '95', session: '49ba1773-57a3-4bed-a739-2656fd0fa6a1', status: [ 'done' ] }
when I do it again it's different, maybe I messed the first one:
op: 'eval',
session: '49ba1773-57a3-4bed-a739-2656fd0fa6a1',
code: '(println "hello")',
'nrepl.middleware.print/options': { 'right-margin': 120, length: 50 },
'nrepl.middleware.print/print': 'cider.nrepl.pprint/pprint',
file: '/home/zimablue/projects/kangrok-core/src_clj/tab_backend/test/from_excel.cljc',
line: 643,
column: 4,
stdout: [Function: stdout],
stderr: [Function: stderr],
pprint: true
}
<- received
{
id: '96',
'nrepl.middleware.print/error': "Couldn't resolve var cider.nrepl.pprint/pprint",
session: '49ba1773-57a3-4bed-a739-2656fd0fa6a1',
status: [ 'nrepl.middleware.print/error' ]
}
<- received
{
id: '96',
ns: 'tab-backend.test.from-excel',
session: '49ba1773-57a3-4bed-a739-2656fd0fa6a1',
value: 'nil'
}
<- received
{
id: '96',
session: '49ba1773-57a3-4bed-a739-2656fd0fa6a1',
status: [ 'done' ]
}
if I toggle "enable pprint for all evaluations" the error in the nrepl log goes away but I still don't get println output in the output.calva.repl window
I’m actually not sure what to expect. ClojureScript pprint is a bit special. Let me see how it behaves for me.
I get it printed as you expect when trying with Calva itself. Which is not exactly an Electron app, but I think it is a good proxy.
by dev console, you mean the bottom terminal output window where the app is running?
This is what I get in the nrepl message log
-> sent
{
id: '504',
op: 'eval',
session: '2d0bbf0e-d288-446c-beb8-1e71793779d7',
code: '(println "hello")',
'nrepl.middleware.print/options': { 'right-margin': 120, length: 50 },
'nrepl.middleware.print/print': 'cider.nrepl.pprint/pprint',
file: '/Users/pez/Projects/calva/.calva/output-window/output.calva-repl',
line: 139,
column: 1,
stdout: [Function: stdout],
stderr: [Function: stderr],
pprint: true
}
<- received
{
id: '504',
out: 'hello',
session: '2d0bbf0e-d288-446c-beb8-1e71793779d7'
}
<- received
{
id: '504',
out: '\n',
session: '2d0bbf0e-d288-446c-beb8-1e71793779d7'
}
<- received
{
id: '504',
ns: 'calva.fmt.formatter',
session: '2d0bbf0e-d288-446c-beb8-1e71793779d7',
value: 'nil'
}
<- received
{
id: '504',
session: '2d0bbf0e-d288-446c-beb8-1e71793779d7',
status: [ 'done' ]
}
<- received
{
'changed-namespaces': {},
id: '504',
'repl-type': 'cljs',
session: '2d0bbf0e-d288-446c-beb8-1e71793779d7',
status: [ 'state' ]
}
Just adding it here for anyone who might be able to make sense of this problem.Not sure if this should go here or #clj-kondo, but posting it here for now as I encounter this with Calva (but not running clj-kondo cli). It seems that clj-kondo stops reporting errors inside a try block, when calling fn's on a different namespace, but if the same fn call is used outside of the try, then both the one outside and the one inside are reported. More in 🧵
When using cli, clj-kondo correctly reports it:
src/b.clj:6:8: error: a/afn is called with 1 arg but expects 2
linting took 42ms, errors: 1, warnings: 0
Even using it via clojure-lsp reports the error:
~/Projects/calva/clojure-lsp diagnostics
[ 99%] Project analyzed Finding diagnostics...
src/b.clj:4:7: info: [clojure-lsp/unused-public-var] Unused public var 'b/bfn'
src/b.clj:6:8: error: [invalid-arity] a/afn is called with 1 arg but expects 2
Do you understand what could be going on, @UKFSJSM38?
Just observed something weird on the original project where I saw this (not the reproduction repo), the error appeared on the file tree (marked 1 error next to filename), then clicked the file, the error showed below the fn call, and then it disappeared (might have saved the file)
Haven't been able to reproduce on the small repro project yet, but on my original project, I am observing that when I reload vscode window without having the affected file on the editor, then the error reappears. When I go to the file, it disappears. At some point, it kept displaying the error until I saved the file, but on further tries to repro, the error disappeared as soon as I opened the file in the editor
that's weird, I can't repro that, maybe some edge case bug in clj-kondo, but we'd need a repro which can consistently or pretty close to that to understand the root cause
Hie! I'm trying to use the Calva TestExplorer and wanted to know if its possible when I run the test to https://calva.io/test-runner/#vs-code-test-ui? Even if possible to write an hook function that automagically does this in calva 👀 I'm getting No tests found
😢
There’s no hook for it, and I am unsure if there’s API for that in VS Code. You can create a custom repl command that loads your test namespaces. https://calva.io/custom-commands/ And there’s calva.autoEvaluateCode.onConnect
https://calva.io/customizing-jack-in-and-connect/ where you can load things on connection of the repl.
(If someone finds a VS Code API for a pre-tests hook, I’d love to know.)
Also One question @U0ETXRFEW when I load a namespace it load all the tree bellow? I don't recall :thinking_face: