This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-15
Channels
- # announcements (13)
- # aws (6)
- # babashka (23)
- # babashka-sci-dev (6)
- # beginners (64)
- # calva (110)
- # cider (25)
- # cljs-dev (5)
- # cljsrn (8)
- # clojars (5)
- # clojure (20)
- # clojure-austin (1)
- # clojure-europe (77)
- # clojure-nl (1)
- # clojure-uk (3)
- # clojurescript (14)
- # cursive (7)
- # datahike (9)
- # datomic (13)
- # eastwood (15)
- # emacs (14)
- # figwheel-main (1)
- # fulcro (8)
- # graalvm-mobile (2)
- # graphql (2)
- # honeysql (2)
- # hyperfiddle (2)
- # introduce-yourself (4)
- # jobs (4)
- # joyride (4)
- # leiningen (4)
- # lsp (8)
- # minecraft (8)
- # off-topic (11)
- # polylith (18)
- # rdf (2)
- # reagent (3)
- # reitit (4)
- # remote-jobs (1)
- # shadow-cljs (39)
- # specter (7)
- # xtdb (3)
Calva v2.0.286 Mac OS VSCode 1.68.0 I’ve deleted .lsp/.cache and .clj-kondo/.cache and restarted VSCode
Obs: this is in a cljc file.
Oddly, the other warning I was going to post is no longer happening ¯\(ツ)/¯
Since this is a cljc file you need to put those in a :clj reader conditional since slurp doesn't exist in cljs
D’oh! Of course.
I've begun seeing a .clj-kondo/babashka start appearing in projects when I use Calva ... do I need to add it to my .gitignore? Its appearance is a surprise because I'm not using babashka.
I'm seeing something strange lately with Calva/LSP: if I add a new namespace to the :require
in an ns
, e.g., [foo.bar :as bar]
, and then in code I type (bar/
I am no longer seeing code completion for vars from that namespace. Sometimes, it'll suggest something like 'foo.bar/some-func
instead of bar/some-func
which is what I'd expect. Any suggestions for debugging why it isn't working?
I've tried restarting LSP to trigger reanalysis. The namespace that I'm requiring is one I've just been editing in Calva, and have eval'd it into the REPL.
Note: I only have nREPL on the classpath, not CIDER, but this used to work just fine so I don't think that's it.
Yes, the files are all syntactically valid and balanced. This happens in all files as far as I can tell.
I'll try but this is all work code.
It produces the correct suggestions for clojure.string
etc, but not our own code.
Do you have any suggestions for debugging that?
It's possible, since this is Windows/WSL2, and it's a new machine. I was previously working on a Mac.
Yes, there is a LSP command to retrieve server info, I think calva has a command for that
OK, will take a look (of course that's on my work machine, where I don't have Slack for Clojurians!).
Trying to run LSP Server Info failed "(command 'clojureLsp.disgnostics.clojureLspServerInfo' not found)"
I don't think it has diagnostics on the name Maybe @U0ETXRFEW knows how to run that?
Looking at the LSP server log, it seems all the paths are relative to a subdirectory in the repo, not the root of the repo, so I bet that has something to do with it...?
In the repo, all the Clojure code is under the clojure
folder, and the main deps.edn
is there. But I have had to add a classpath.sh
script to run clojure -Spath ...
with all the right aliases...
Right, but I should be able to tell it to use a different folder for LSP analysis, yes?
No, the client send the project root and I don't think calva has a setting for that
OK, I think I've fixed it. My classpath.sh
had a cd
command in it because I thought it needed it, but that caused the paths to be relative instead of absolute.
Now I'm getting the correct code suggestions.
Maybe you can add a root deps.edn with a specific alias that uses a local root of the subdirectory
I notice that the LSP logs complains there's no nREPL on the classpath so it doesn't start an nREPL Server -- what functionality am I missing out on?
Well, the clojure
folder is a Polylith mono-project so LSP needs to be told about the aliases to use to compute the classpath -- by default, the root deps.edn
brings in no code.
@U04V70XH6 thats why I suggested using source-aliases setting
Ah, I didn't know about that. I have :project-path
set to clojure/deps.edn
. Are you saying I just need :source-aliases
instead of the :classpath-cmd
and the shell script?
As for JVM vs Graal version, it's running whatever version of LSP Calva figures out -- I haven't done anything with that stuff.
OK, got :source-aliases
working, thank you!
What about the nREPL server thing?
Oh, forget about that, it's a debug log that nrepl is not available because it's a Graal binary. It's expected, we use the nrepl just to debug clojure-lsp code while developing
Hi everyone! I just joined this Slack channel. 🙂 I have been using Calva (with VS Code) for learning Clojure - it's quite good! I am starting to make a TUI program - but I can't figure out how to show the running TUI app in a seperate terminal from the Calva Output REPL. Basically, I want to run a TUI program, while still being able to eval expressions in Calva Output REPL. I checked out this page: https://docs.cider.mx/cider/basics/middleware_setup.html , but I didn't really understand it. Can anyone help me out with this? Any pointers?
Hi @U0ETXRFEW I am planning to make a TUI library. I am sure that similar libraries already exist, but this is mainly for my own learning.
@U0ETXRFEW TUI = Terminal User Interface - it basically imitates GUI on the command line with boxes, alignment, etc. For example, Lynx - a terminal browser. My idea was to try to render a subset of HTML in the command line.
So that's what I thought a TUI was as well. But somehow you are reading Embedded nREPL docs, so it seems there is more to your TUI and that it has to do with the REPL?
I might be completely misunderstanding. In any case, if you elaborate more in detail what it is you want to achieve, then maybe I can see some way to do it. (Or anyone. I saw @U07FP7QJ0 seemed to understand where you where going in the other thread you started.)
@U0ETXRFEW I want to output rendered HTML in a terminal (which may include animations), and be able to interact with it using Calva's Output REPL. That is, actual program output and REPL interaction output are in two seperate windows / terminals.
The REPL is able to eval expressions in the context of the running program.
This is similar to Debug terminal in various languages - however I want to be able to eval expressions directly from my input code file (as we can do usually with Calva).
I see. Since your TUI will be written in Clojure, it should have a REPL you can connect to, right? Want to chat via the voice huddle here a bit? Then we can screen share too and maybe things get clearer for me.
Maybe later? Traveling right now, lots of noise here.
Also, my spoken English isn't that great - be warned 😀
If you can create an example project and share, I can have a look and see if I understand how to get it working.
I'll voice call (huddle?) you in an hour (as I said, I am traveling right now)
BTW I'm from India? Where are you from?
I'm from many different places. 😃 (Sorry, old Highlander joke). Anyway, I am a Swede, living in Sweden, speaking English broken in Swedish. (But originally I am from Colombia.)
@U0ETXRFEW Um.. can't figure out how to start a voice call or huddle with you. Huddle seems to be a paid feature - I'm currently using the free web version of Slack.
It's the server that needs to be pro, which we actually have. Can you see the huddle opened in the #calva channel? (Down to the left I see it).
@U04V15CAJ Not using any tech for the TUI - haven't actually started it yet 🙂. It's just in thinking / planning phase right now.
@U03L31E1Y1F Cool. Maybe nbb + ink is something worth trying https://github.com/babashka/nbb#reagent
@U0ETXRFEW Do you think it would be useful to also post my issue in other channels?
@U03L31E1Y1F I think it's best to set up an example project that exposes the problem. It's easier to reason about it and alternatives/workarounds then.
@U0ETXRFEW How about this - a word is stored in a mutable variable (maybe an atom?) Then it's simply printed in an infinite loop. We would like to modify the word being printed by mutating the word variable from REPL. (Of course, the new word value should also show in REPL. Also, we should be able to modify word by evaluating expression from either input file or directly from REPL)
You mean as an example app? That'd work. Maybe it should have some function which prints ”in-band” (in the same eval
) as well. I know some nREPL servers has been known to treat out-of-band and in-band output differently.
Sorry - didn't understand what you meant by in-band. Did you mean using eval
somewhere in the code?
And print
inside eval
?
I meant, if the print is done in the code being evaluated, that's in-band. If it is done in some other thread, it is out-of-band. I might be using the wrong terminology.
Got it - that sounds like a good idea!
If you enable the nrepl message log in Calva, you should be able to see the difference in the messages received.
@U0ETXRFEW Would this example project (https://github.com/sohang3112/example-clojure-app) be ok? It's just the lein new app
template, with my modifications in core.clj. Please create a pull request if you think some changes are required in it.
I wouldn't even dare start an app with a loop like that 😃 Will try to find some time to provide more constructive feedback.
@U0ETXRFEW please do send more constructive feedback when you have time
To my experience, programs that have a while true
loop where nothing really happens often heat up my CPU until I find a way to stop them. And I don't think you would be able to interact with the REPL after evaluating it, so it is not supporting the experiment very well.
I've filed a PR with some changes. Now what's lacking is a README that tells what the project is about.
@U0ETXRFEW I have merged your PR.
I have a question regarding your PR - in src/exampleclojure_app/core.clj_, you have written near the end of the file (in a rich comment) that wierd stuff happens on evaluating @f
. What do you mean by that?
Yeah, I don't think that should be kept in the example. It was more something I noticed, and that you might be interested in. Dereferencing the future that is still executing seems to spawn off new threads or something. I haven't investigated, but at some point I couldn't interrupt the heartbeat, neither by swapping in :quit
in the !state
atom or by interrupting the evaluation (via Calva's command for that).
@U0ETXRFEW Were you able to verify (via something like htop
) that multiple threads are actually being spawned?
@U04V15CAJ Your suggestion (nbb + ink) seems interesting - it seems to do exactly what I wanted! Since I'm a beginner, the fact that it's ClojureScript instead of Clojure shouldn't make much difference. Thanks!
@U0ETXRFEW The suggestion by @U04V15CAJ (nbb + ink) seems interesting - I might go with that! Have you used this kind of setup?
@U03L31E1Y1F It depends on how complex your TUI must be. If it's just a questionnaire, you can also look at:
npx clojure-quiz
which is made with nbb and uses some console library for prompting input :)I haven't done much of that at all, but I've followed along in this tutorial and had it working (not a general TUI, but nbb and stuff).
This tutorial 😃 https://www.youtube.com/watch?v=_-G9EKaAyuI
I have the following in my VS Code settings JSON but when I do a global find, it still matches things in my Calva output REPL window -- any suggestions?
"search.exclude": {
"**/.calva/output-window/output.calva-repl": true
}
I also have .calva
in my .gitignore
file.
I’ll give it a try and see if I can figure it out. But it sure looks like that excluded should do it.
open files are always included in results
Ah, that explains it! Thanks @U015879P2F8!
If I explicitly add *.calva-repl
to the files to exclude
box, it works even with the repl window being open so that's a workaround...
Thanks, @U015879P2F8!
My VS Code Calva window started crashing today, every time I pressed Tab to indent, and also sometimes when I did not press Tab, but perhaps I may have triggered formatting with a different keystroke. It crashed regardless of whether a REPL was open. After I unchecked the setting to start LSP, the crashes stopped. I tried "Open Clojure LSP log" (and reviewed the file after the crash, having observed /tmp in the tab name) but there were no errors in that log. Calva was 2.0.286 but I did not see a version number in the LSP log. Edit: The crashes were preceded by several seconds of unresponsiveness, sometimes long enough for a box to come up asking me whether I wanted to close the window or wait for it; and when I scooted over to a terminal (outside VS Code) "top" showed VS Code using more than 100% of CPU.
This is probably a vscode issue, LSP client side, not related with clojure-lsp or Calva
You are not the first to experience this Phill. While I understand the boundary between clojure-lsp and vscode, I'm 100% positive that stopping clojure-lsp makes the problem go away. I cleared up all caches, reinstalled vscode from scratch, tried older versions and the problem remains. There is an issue somewhere, and it made me stop using clojure-lsp with vscode.
Just to be clear that clojure-lsp is a process that calva/vscode spawns, and if the editor is freezing is a issue completely on editor side, I suspect it can be something on the vscode-language-client extension. Maybe try a older calva which has that plugin as a older version
I have a colleague whose VS Code couldn't support our project's setup, @U2DART3HA and OP. We ended up trying out the VS Code Insiders version (preview, less stable) and it worked on his machine. Weird but it's the only way we found on his machine to make things work. It's been going on like this for months and months. Uninstalling (profoundly and manually deep) and reinstalling didn't help. Only using this other version helped.